This commit is contained in:
gongxh
2022-05-05 09:38:28 +08:00
parent ff80fe49e3
commit 3593c53fbe
2 changed files with 31 additions and 23 deletions

View File

@@ -1,8 +1,14 @@
//使用本地调式
#define USE_LOCAL_TCP_DEBUG
//启用心跳检查
// #define UseHeartbeat
#if DEBUG
#define USE_LOCAL_TCP_DEBUG
#endif
//启用心跳检查
#if RELEASE
#define UseHeartbeat
#endif
using CleanMachine.Model;
using LeadDataBaseUtility;
@@ -84,7 +90,7 @@ namespace CleanMachineHMI
public bool PlcInit()
{
#if !DEBUG
#if RELEASE
try
{
#endif
@@ -122,8 +128,8 @@ namespace CleanMachineHMI
#endif
return true;
#if !DEBUG
}
#if RELEASE
}
catch (Exception ex)
{
LogHelper.WriteLog($"初始化PLC连接时发生异常:【{ex.Message}】", LogTypeEum.Err);
@@ -147,7 +153,7 @@ namespace CleanMachineHMI
}
public void RefreshPlcItem_M()
{
#if !DEBUG
#if RELEASE
try
{
#endif
@@ -184,7 +190,7 @@ namespace CleanMachineHMI
}
}
}
#if !DEBUG
#if RELEASE
}
catch (Exception ex)
{
@@ -194,7 +200,7 @@ namespace CleanMachineHMI
}
public void RefreshPlcItem_D()
{
#if !DEBUG
#if RELEASE
try
{
#endif
@@ -249,7 +255,7 @@ namespace CleanMachineHMI
}
HandleWaringLog(tmpReadAlarmBytArr_D);
}
#if !DEBUG
#if RELEASE
}
catch (Exception ex)
{
@@ -261,7 +267,7 @@ namespace CleanMachineHMI
//报警信息记录
private void HandleWaringLog(ushort[] tmpReadAlarmBytArr_D)
{
#if !DEBUG
#if RELEASE
try
{
#endif
@@ -587,7 +593,7 @@ namespace CleanMachineHMI
//frmMainNew.Show_ptb_Alarm(false);
GlobalHelper.ShowMainFrmAlarmMsg(false, EventArgs.Empty);
}
#if !DEBUG
#if RELEASE
}
catch (Exception ex)
{
@@ -598,7 +604,7 @@ namespace CleanMachineHMI
public void RefreshPlcItem_X()
{
#if !DEBUG
#if RELEASE
try
{
#endif
@@ -626,7 +632,7 @@ namespace CleanMachineHMI
}
}
}
#if !DEBUG
#if RELEASE
}
catch (Exception ex)
{
@@ -637,7 +643,7 @@ namespace CleanMachineHMI
public void RefreshPlcItem_Y()
{
#if !DEBUG
#if RELEASE
try
{
#endif
@@ -665,7 +671,7 @@ namespace CleanMachineHMI
}
}
}
#if !DEBUG
#if RELEASE
}
catch (Exception ex)
{
@@ -677,7 +683,7 @@ namespace CleanMachineHMI
public object ReadPlcItem(string plcItemCode, PlcItemTypeDesc itemType)
{
#if !DEBUG
#if RELEASE
try
{
#endif
@@ -750,7 +756,7 @@ namespace CleanMachineHMI
break;
}
return retObj;
#if !DEBUG
#if RELEASE
}
catch (Exception ex)
{
@@ -763,7 +769,7 @@ namespace CleanMachineHMI
public bool WritePlcItem(string plcItemCode, string writeValue, PlcItemTypeDesc itemType)
{
#if !DEBUG
#if RELEASE
try
{
#endif
@@ -798,7 +804,7 @@ namespace CleanMachineHMI
default:
return false;
}
#if !DEBUG
#if RELEASE
}
catch (Exception ex)
{
@@ -809,13 +815,13 @@ namespace CleanMachineHMI
}
private int wcsToPlcHeartDataNew = 0;
private DateTime HeartbeatTime = new DateTime();
private int ReConnNum = 1;
/// <summary>
/// 心跳处理
/// </summary>
public void HeartbeatDetection()
{
#if !DEBUG
#if RELEASE
try
{
#endif
@@ -889,7 +895,7 @@ namespace CleanMachineHMI
}
#endif
#if !DEBUG
#if RELEASE
}
catch (Exception ex)
{