现场测试主流程修改

master
lxw 6 months ago
parent 471eade709
commit 28dfb76bc3

@ -45,6 +45,7 @@ public class InfoEnum
[Info("车辆驶入","车辆驶入")] CarInInfo, [Info("车辆驶入","车辆驶入")] CarInInfo,
[Info("换电任务启动","换电任务启动")] StartSwapInfo, [Info("换电任务启动","换电任务启动")] StartSwapInfo,
[Info("航车拍照中,请稍后","航车拍照中,请稍后")] CarTakePhotoInfo,
} }

@ -28,6 +28,6 @@ public class CloudClientMgr
CloudClient.InitHandler(); CloudClient.InitHandler();
Task.Run(() => CloudClient.Connect()); //Task.Run(() => CloudClient.Connect());
} }
} }

@ -1,4 +1,5 @@
using HybirdFrameworkDriver.ModbusTcpMaster; using HybirdFrameworkDriver.ModbusTcpMaster;
using log4net;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Text; using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
using Service.Cloud.Msg.Cloud.Req; using Service.Cloud.Msg.Cloud.Req;
using Service.Init.Entity; using Service.Init.Entity;
@ -10,7 +11,7 @@ namespace Service.Execute.Api;
public class PlcApi public class PlcApi
{ {
private const int TimeSpan = 60; private const int TimeSpan = 60;
private static readonly ILog Log = LogManager.GetLogger(typeof(PlcApi));
/// <summary> /// <summary>
/// PLC是否连接 /// PLC是否连接
@ -128,7 +129,9 @@ public class PlcApi
/// <returns></returns> /// <returns></returns>
public static ushort ChannelStatus() public static ushort ChannelStatus()
{ {
return PlcMgr.ChannelStatus(); var channelStatus = PlcMgr.ChannelStatus();
Log.Info($"plc ChannelStatus = {channelStatus}");
return channelStatus;
} }

@ -336,11 +336,17 @@ public class DoSwappingState : IState
/// <returns></returns> /// <returns></returns>
public StateResult CheckChannelStatus(SwappingStateMachine machine) public StateResult CheckChannelStatus(SwappingStateMachine machine)
{ {
int count = 0;
while (!machine.ChannelStatusOkFlag) while (!machine.ChannelStatusOkFlag)
{ {
_log.Info("begin plc CheckChannelStatus"); _log.Info("begin plc CheckChannelStatus");
Thread.Sleep(1000); Thread.Sleep(1000);
var channelStatus = PlcApi.ChannelStatus(); var channelStatus = PlcApi.ChannelStatus();
if (count % 10 == 0)
{
SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.CarTakePhotoInfo);
}
if (channelStatus == 1000) if (channelStatus == 1000)
{ {
machine.ChannelStatusOkFlag = true; machine.ChannelStatusOkFlag = true;
@ -358,7 +364,8 @@ public class DoSwappingState : IState
Thread.Sleep(3000); Thread.Sleep(3000);
machine.VehiclesInPlace2Flag = false; machine.VehiclesInPlace2Flag = false;
machine.StartSwappingFlag = false; machine.StartSwappingFlag = false;
machine.PlcHoldFlag = false;
machine.ChannelStatusOkFlag = false;
//回归到本阶段的读锁止状态 //回归到本阶段的读锁止状态
return new StateResult() return new StateResult()
{ {

Loading…
Cancel
Save