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

@@ -27,7 +27,9 @@ namespace CleanMachineHMI
Application.EnableVisualStyles(); Application.EnableVisualStyles();
//frmUtil.DB2Json();//语言字典从数据库转json //frmUtil.DB2Json();//语言字典从数据库转json
GlobalHelper.LoadTheme(); GlobalHelper.LoadTheme();
#if DEBUG
GlobalHelper.LoadzhCN(); GlobalHelper.LoadzhCN();
#endif
Application.SetCompatibleTextRenderingDefault(false); Application.SetCompatibleTextRenderingDefault(false);
GlobalHelper.LoadAllFormData(); GlobalHelper.LoadAllFormData();
Application.Run(GlobalHelper.LoginForm); Application.Run(GlobalHelper.LoginForm);

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