From cd2d24773836e2974ced71d9fe691c598119700e Mon Sep 17 00:00:00 2001 From: lxw Date: Wed, 29 May 2024 12:09:20 +0800 Subject: [PATCH] =?UTF-8?q?=E7=8E=B0=E5=9C=BA=E6=B5=8B=E8=AF=95=E6=8F=90?= =?UTF-8?q?=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Entity/Constant/InfoEnum.cs | 20 +++++++++++--------- Service/Cloud/Client/CloudClient.cs | 1 + Service/Cloud/Client/CloudClientMgr.cs | 3 +-- Service/Execute/Api/PlcApi.cs | 4 ++++ Service/Execute/Step/StationReadyState.cs | 17 +++++++++-------- Service/Plc/Client/PlcMgr.cs | 17 ++++++++++++++--- 6 files changed, 40 insertions(+), 22 deletions(-) diff --git a/Entity/Constant/InfoEnum.cs b/Entity/Constant/InfoEnum.cs index 68f7d1b..388c03b 100644 --- a/Entity/Constant/InfoEnum.cs +++ b/Entity/Constant/InfoEnum.cs @@ -6,11 +6,12 @@ public class InfoEnum { public enum SwapInfo : ushort { + - [Info("欢迎光临长治换电站!(正在营业)","欢迎光临长治换电站!,本站正在营业中")]WelcomeInfo=1, - [Info("Rfid读写失败", "Rfid读写失败")] ErrorReadRfid , + [Info("欢迎光临换电站!(正在营业)","欢迎光临换电站!,本站正在营业中")]WelcomeInfo=1, + [Info("标签读写失败", "标签读写失败")] ErrorReadRfid , - [Info("Tbox连接失败", "Tbox连接失败,请联系站务人员")] ErrorTBoxConn , + [Info("车辆连接失败", "车辆连接失败,请联系站务人员")] ErrorTBoxConn , [Info("云端校验失败", "云端校验失败,请联系站务人员")] ErrorCloudCheck , [Info("车辆已到位", "车辆已到位")] InfoCarInPosition , [Info("车辆到位超时", "车辆到位超时")] ErrorCarInPositionTimeout, @@ -19,11 +20,9 @@ public class InfoEnum [Info("解锁车辆失败", "解锁车辆失败")] ErrUnLockCar , [Info("选包失败,请驶离", "选包失败,请驶离")] ErrorSelectPack , - - - - [Info("通道拍照定位失败,请重新调整车辆位置", "通道拍照定位失败,请重新调整车辆位置")] - ErrChannelStatus , + [Info("通道拍照定位失败,请重新调整车辆位置", "通道拍照定位失败,请重新调整车辆位置")]ErrChannelStatus, + + [Info("电池拆卸中,请稍后", "电池拆卸中,请稍后")] InfoUnPack , [Info("电池安装中,请稍后", "电池安装中,请稍后")] InfoPack , @@ -32,13 +31,16 @@ public class InfoEnum [Info("换电已完成,请驶离", "换电已完成,请驶离")] InfoCarLeave , [Info("换电失败,请驶离", "换电失败,请驶离")] ErrInfoCarLeave , [Info("旧电池搬运中,请稍后", "旧电池搬运中,请稍后")] InfoOldBatteryCarryIn , - [Info("旧电池搬运中,请稍后", "旧电池搬运中,请稍后")] InfoNewBatteryCarryOut , + [Info("新电池搬运中,请稍后", "新电池搬运中,请稍后")] InfoNewBatteryCarryOut , [Info("车辆上锁失败", "车辆上锁失败")] ErrLockCar , [Info("通道的电池仓无可用换电电池","通道的电池仓无可用换电电池")] NoBatteryErr, [Info("结束充电电池数量不足","通道的电池仓无可用换电电池")] LessOfFinishChargingErr, [Info("空仓数量不足","通道的电池仓无可用换电电池")] LessOfEmptyBinErr, [Info("符合soc限制数量不足","通道的电池仓无可用换电电池")] LessOfSocErr, [Info("结束充电大于3分钟的数量不足","通道的电池仓无可用换电电池")] LessOf3MinuteErr, + [Info("换电站处于手动模式,不能自动换电","换电站处于手动模式,不能自动换电")]InfoStationModel, + + [Info("换电站处于本地模式,不能远程换电","换电站处于本地模式,不能远程换电")]InfoStationModelRemoteErr, } public enum SelectBinStatusInfo : byte diff --git a/Service/Cloud/Client/CloudClient.cs b/Service/Cloud/Client/CloudClient.cs index 627aa2c..a280e75 100644 --- a/Service/Cloud/Client/CloudClient.cs +++ b/Service/Cloud/Client/CloudClient.cs @@ -360,6 +360,7 @@ public class CloudClient : IMqttClientConnectedHandler, IMqttApplicationMessageR public VehicleCertificationResp? SendVehicleCertification(VehicleCertification vehicleCertification, TimeSpan timeSpan) { + Log.Info(vehicleCertification); this.CarAuth.Req = vehicleCertification; this.Publish(vehicleCertification); return CarAuth.GetResp(timeSpan); diff --git a/Service/Cloud/Client/CloudClientMgr.cs b/Service/Cloud/Client/CloudClientMgr.cs index 9a0f049..00db490 100644 --- a/Service/Cloud/Client/CloudClientMgr.cs +++ b/Service/Cloud/Client/CloudClientMgr.cs @@ -13,7 +13,6 @@ public class CloudClientMgr public static void Init() { - SysConfigService sysConfigService = AppInfo.Container.Resolve(); CloudClient = AppInfo.Container.Resolve(); CloudClient.ServerIp = StaticStationInfo.CloudServerIp; @@ -29,6 +28,6 @@ public class CloudClientMgr CloudClient.InitHandler(); - // BusinessTask.Run(() => CloudClient.Connect()); + Task.Run(() => CloudClient.Connect()); } } \ No newline at end of file diff --git a/Service/Execute/Api/PlcApi.cs b/Service/Execute/Api/PlcApi.cs index 863486d..1e52bbb 100644 --- a/Service/Execute/Api/PlcApi.cs +++ b/Service/Execute/Api/PlcApi.cs @@ -36,6 +36,10 @@ public class PlcApi return PlcMgr.IsRemote(); } + public static bool IsAuto() + { + return PlcMgr.IsAuto(); + } /// /// 入口雷达检测 /// diff --git a/Service/Execute/Step/StationReadyState.cs b/Service/Execute/Step/StationReadyState.cs index 787c69b..8533be9 100644 --- a/Service/Execute/Step/StationReadyState.cs +++ b/Service/Execute/Step/StationReadyState.cs @@ -93,12 +93,16 @@ public class StationReadyState : IState //LED显示-欢迎光临_换电站点_正在营业 string welcomeContent = "欢迎光临" + StaticStationInfo.StationName + "正在营业"; SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.WelcomeInfo); - // machine.LedTool?.WriteContent(welcomeContent); + // machine.LedTool?.WriteContent(welcomeContent); isRemote = true; } } }, - () => { }, true); + () => + { + SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.InfoStationModelRemoteErr) + ; + }, true); } public InvokeStatus EntranceRadar(SwappingStateMachine machine) @@ -138,7 +142,7 @@ public class StationReadyState : IState } }, () => { - // machine.LedTool.WriteProgramContent(InfoEnum.SwapInfo.ErrorReadRfid.GetLed()); + // machine.LedTool.WriteProgramContent(InfoEnum.SwapInfo.ErrorReadRfid.GetLed()); SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.ErrorReadRfid); }, false, () => { machine.ExceptionReason = ExceptionReason.ReadRfidError; } , 1, InvokeStatus.TimeOut); @@ -181,9 +185,8 @@ public class StationReadyState : IState //TODO::开始读rfid RfidService.BeginRead(); Task rfidReadModel = RfidApi.ReadRifd(); rfidReadModel.Wait(); - if (/*rfidReadModel.IsCompletedSuccessfully &&*/ rfidReadModel.Result != null) + if ( /*rfidReadModel.IsCompletedSuccessfully &&*/ rfidReadModel.Result != null) { - machine.RfidReadModel = rfidReadModel.Result; _log.Info($"read rfid={JsonConvert.SerializeObject(machine.RfidReadModel)}"); @@ -207,7 +210,7 @@ public class StationReadyState : IState } }, () => { - // machine.LedTool!.WriteProgramContent(InfoEnum.SwapInfo.ErrorReadRfid.GetLed()); + // machine.LedTool!.WriteProgramContent(InfoEnum.SwapInfo.ErrorReadRfid.GetLed()); SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.ErrorReadRfid); }, true, () => { machine.ExceptionReason = ExceptionReason.ReadRfidError; }, 10, InvokeStatus.Exception); @@ -227,6 +230,4 @@ public class StationReadyState : IState return swapOrder; } - - } \ No newline at end of file diff --git a/Service/Plc/Client/PlcMgr.cs b/Service/Plc/Client/PlcMgr.cs index 3ec55b8..fbb3129 100644 --- a/Service/Plc/Client/PlcMgr.cs +++ b/Service/Plc/Client/PlcMgr.cs @@ -61,9 +61,20 @@ public class PlcMgr { if ((DateTime.Now - DataValidityTime).Seconds <= DataTimeSeconds) { - return (PlcToHostData.ModeControl.Value == 1010 && PlcToHostData.RemoteLocalControlState.Value == 1010) - ? true - : false; + return PlcToHostData.RemoteLocalControlState.Value == 1010; + + } + else + { + return false; + } + } + public static bool IsAuto() + { + if ((DateTime.Now - DataValidityTime).Seconds <= DataTimeSeconds) + { + return PlcToHostData.ModeControl.Value == 1010; + } else {