2024-06-21 09:30:10 +08:00
|
|
|
|
using CirculateTool.Attribute;
|
2024-05-14 16:30:56 +08:00
|
|
|
|
using WcsMain.Common;
|
2024-05-30 15:34:20 +08:00
|
|
|
|
using WcsMain.EquipOperation;
|
2024-05-14 16:30:56 +08:00
|
|
|
|
|
2024-05-30 15:34:20 +08:00
|
|
|
|
namespace WcsMain.Business.CirculationTask.CommonCirculation;
|
2024-05-14 16:30:56 +08:00
|
|
|
|
|
|
|
|
|
|
/// <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 */
|
2024-06-19 16:51:35 +08:00
|
|
|
|
bool isContinue = connectPLCs.ConnectPlc();
|
2024-05-14 16:30:56 +08:00
|
|
|
|
if (!isContinue)
|
|
|
|
|
|
{
|
|
|
|
|
|
return false; // 没有需要连接PLC可能,不需要接着继续检测了
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|