34 lines
891 B
C#
34 lines
891 B
C#
using CirculateTool;
|
||
using WcsMain.Common;
|
||
using WcsMain.EquipOperation;
|
||
|
||
namespace WcsMain.Business.CirculationTask.CommonCirculation;
|
||
|
||
/// <summary>
|
||
/// 定时器检测 PLC 是否连接,若没有连接则重新连接
|
||
/// </summary>
|
||
[Circulation]
|
||
public class ConnectPlcWithCirculation(ConnectPLCs connectPLCs)
|
||
{
|
||
|
||
/// <summary>
|
||
/// 当plc断开时重新连接 PLC
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[Circulation("连接PLC", 5000)]
|
||
public bool ReconnectPlc()
|
||
{
|
||
if (CommonData.IsConnectPlc == false)
|
||
{
|
||
// 如果处于未连接的状态则需要连接
|
||
/* 连接 PLC */
|
||
bool isContinue = connectPLCs.ConnectPlc();
|
||
if (!isContinue)
|
||
{
|
||
return false; // 没有需要连接PLC可能,不需要接着继续检测了
|
||
}
|
||
}
|
||
return true;
|
||
}
|
||
|
||
} |