diff --git a/Entity/Constant/InfoEnum.cs b/Entity/Constant/InfoEnum.cs index 0dbbf90..6376549 100644 --- a/Entity/Constant/InfoEnum.cs +++ b/Entity/Constant/InfoEnum.cs @@ -45,6 +45,7 @@ public class InfoEnum [Info("车辆驶入","车辆驶入")] CarInInfo, [Info("换电任务启动","换电任务启动")] StartSwapInfo, + [Info("航车拍照中,请稍后","航车拍照中,请稍后")] CarTakePhotoInfo, } diff --git a/Service/Cloud/Client/CloudClientMgr.cs b/Service/Cloud/Client/CloudClientMgr.cs index 00db490..df24247 100644 --- a/Service/Cloud/Client/CloudClientMgr.cs +++ b/Service/Cloud/Client/CloudClientMgr.cs @@ -28,6 +28,6 @@ public class CloudClientMgr CloudClient.InitHandler(); - Task.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 1e52bbb..809846a 100644 --- a/Service/Execute/Api/PlcApi.cs +++ b/Service/Execute/Api/PlcApi.cs @@ -1,4 +1,5 @@ using HybirdFrameworkDriver.ModbusTcpMaster; +using log4net; using OfficeOpenXml.FormulaParsing.Excel.Functions.Text; using Service.Cloud.Msg.Cloud.Req; using Service.Init.Entity; @@ -10,7 +11,7 @@ namespace Service.Execute.Api; public class PlcApi { private const int TimeSpan = 60; - + private static readonly ILog Log = LogManager.GetLogger(typeof(PlcApi)); /// /// PLC是否连接 @@ -128,7 +129,9 @@ public class PlcApi /// public static ushort ChannelStatus() { - return PlcMgr.ChannelStatus(); + var channelStatus = PlcMgr.ChannelStatus(); + Log.Info($"plc ChannelStatus = {channelStatus}"); + return channelStatus; } diff --git a/Service/Execute/Step/DoSwappingState.cs b/Service/Execute/Step/DoSwappingState.cs index 3695092..ccbbd0d 100644 --- a/Service/Execute/Step/DoSwappingState.cs +++ b/Service/Execute/Step/DoSwappingState.cs @@ -336,11 +336,17 @@ public class DoSwappingState : IState /// public StateResult CheckChannelStatus(SwappingStateMachine machine) { + int count = 0; while (!machine.ChannelStatusOkFlag) { _log.Info("begin plc CheckChannelStatus"); Thread.Sleep(1000); var channelStatus = PlcApi.ChannelStatus(); + if (count % 10 == 0) + { + SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.CarTakePhotoInfo); + } + if (channelStatus == 1000) { machine.ChannelStatusOkFlag = true; @@ -358,7 +364,8 @@ public class DoSwappingState : IState Thread.Sleep(3000); machine.VehiclesInPlace2Flag = false; machine.StartSwappingFlag = false; - + machine.PlcHoldFlag = false; + machine.ChannelStatusOkFlag = false; //回归到本阶段的读锁止状态 return new StateResult() {