1.GemManager增加Try Catch捕获异常
This commit is contained in:
parent
d280ebedc9
commit
b58d3c89f4
|
@ -368,3 +368,4 @@ FodyWeavers.xsd
|
||||||
*.DotSettings
|
*.DotSettings
|
||||||
Output/
|
Output/
|
||||||
BuildTools/
|
BuildTools/
|
||||||
|
*.json
|
||||||
|
|
|
@ -505,6 +505,8 @@ namespace MECF.Framework.Common.Gem
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Log_NewMessage(LogType loggingType, string customizedLogTypeName, DateTime timeStamp, string processName, int threadID, string source, string message)
|
private void Log_NewMessage(LogType loggingType, string customizedLogTypeName, DateTime timeStamp, string processName, int threadID, string source, string message)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
// make a filter, do not show SML logging message at current window
|
// make a filter, do not show SML logging message at current window
|
||||||
if (message.Contains("SECS MSG Recv") || message.Contains("SECS MSG Sent"))
|
if (message.Contains("SECS MSG Recv") || message.Contains("SECS MSG Sent"))
|
||||||
|
@ -514,8 +516,15 @@ namespace MECF.Framework.Common.Gem
|
||||||
|
|
||||||
ProgramLog += $"{timeStamp.ToString("yyyy/MM/dd HH:mm:ss,fff")} {source} 线程ID:{threadID} 内容:{message}\r\n";
|
ProgramLog += $"{timeStamp.ToString("yyyy/MM/dd HH:mm:ss,fff")} {source} 线程ID:{threadID} 内容:{message}\r\n";
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LOG.Error(ex.Message, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void DataMessageReceived(string equipmentName, string connectionName, DateTime time, Kxware.Automation.Secs.DataMessage message)
|
private void DataMessageReceived(string equipmentName, string connectionName, DateTime time, Kxware.Automation.Secs.DataMessage message)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
if (connectionName == _equipment.MasterConnectionName)
|
if (connectionName == _equipment.MasterConnectionName)
|
||||||
{
|
{
|
||||||
|
@ -529,8 +538,15 @@ namespace MECF.Framework.Common.Gem
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LOG.Error(ex.Message, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void EventTriggered(string equipmentName, string connectionName, ulong eventID, string eventName, string eventDescription, Kxware.Common.VariableData[] associatedVariables, Kxware.Automation.Secs.DataMessage eventSecsMessage)
|
private void EventTriggered(string equipmentName, string connectionName, ulong eventID, string eventName, string eventDescription, Kxware.Common.VariableData[] associatedVariables, Kxware.Automation.Secs.DataMessage eventSecsMessage)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
if (connectionName == _equipment.MasterConnectionName)
|
if (connectionName == _equipment.MasterConnectionName)
|
||||||
{
|
{
|
||||||
|
@ -542,8 +558,15 @@ namespace MECF.Framework.Common.Gem
|
||||||
EventInfoList.Add($"{DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")} 编号:{eventID} 事件名:{eventName} {associatedDataInfo}");
|
EventInfoList.Add($"{DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")} 编号:{eventID} 事件名:{eventName} {associatedDataInfo}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LOG.Error(ex.Message, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private enumRemoteCommandAckCode OnReceivedRemoteCommand(string connectionName, string objSpec, string remoteCommand, List<RemoteCommandParameter> remoteCommandParameters)
|
private enumRemoteCommandAckCode OnReceivedRemoteCommand(string connectionName, string objSpec, string remoteCommand, List<RemoteCommandParameter> remoteCommandParameters)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
//只接受从MasterConnection 收到的控制命令
|
//只接受从MasterConnection 收到的控制命令
|
||||||
if (connectionName != _equipment.MasterConnectionName)
|
if (connectionName != _equipment.MasterConnectionName)
|
||||||
|
@ -734,7 +757,7 @@ namespace MECF.Framework.Common.Gem
|
||||||
|
|
||||||
string module = remoteCommandParameters.Find(p => p.CPNAME == "ModuleID").CPVAL.GetValueAsString();
|
string module = remoteCommandParameters.Find(p => p.CPNAME == "ModuleID").CPVAL.GetValueAsString();
|
||||||
int slot = remoteCommandParameters.Find(p => p.CPNAME == "SlotID").CPVAL.GetValueAsInt(0);
|
int slot = remoteCommandParameters.Find(p => p.CPNAME == "SlotID").CPVAL.GetValueAsInt(0);
|
||||||
OP.DoOperation($"CreateTray",module,slot);
|
OP.DoOperation($"CreateTray", module, slot);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -772,6 +795,11 @@ namespace MECF.Framework.Common.Gem
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return enumRemoteCommandAckCode.CannotPerformNow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private bool SetSoftwareVersion(string softwareVersion)
|
private bool SetSoftwareVersion(string softwareVersion)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue