1.SV按照配置文件初始化

This commit is contained in:
HCL 2024-04-23 17:12:17 +08:00
parent 7bc1e369f1
commit 3c0f639079
1 changed files with 18 additions and 2 deletions

View File

@ -119,7 +119,7 @@ namespace MECF.Framework.Common.Gem
int equipmentNo = SC.GetValue<int>("System.EquipmentNo"); int equipmentNo = SC.GetValue<int>("System.EquipmentNo");
_equipment = new Kxware.ToolAutomation.Equipment(equipmentName); _equipment = new Kxware.ToolAutomation.Equipment(equipmentName);
_equipment.RegisteringVariables += new RegisterVariableDelegate(RegisteringVariables); //_equipment.RegisteringVariables += new RegisterVariableDelegate(RegisteringVariables);
//_equipment.RegisteringAlarms += new RegisterAlarmDelegate(RegisteringAlarms); //_equipment.RegisteringAlarms += new RegisterAlarmDelegate(RegisteringAlarms);
@ -277,7 +277,9 @@ namespace MECF.Framework.Common.Gem
try try
{ {
//设置变量值 //设置变量值
SetValue(); //SetValue();
SetXmlValue();
return true; return true;
} }
@ -287,6 +289,20 @@ namespace MECF.Framework.Common.Gem
} }
} }
//设置GEM配置文件中变量的值
private void SetXmlValue()
{
SortedDictionary<string, Func<object>> keyValues = Singleton<DataManager>.Instance.GetDBRecorderList();
foreach (Variable variable in _equipment.GetVariables())
{
if(keyValues.ContainsKey(variable.Name))
{
_equipment?.SetValue(variable.Name, keyValues[variable.Name]());
}
}
}
private void SetValue() private void SetValue()
{ {
SortedDictionary<string, Func<object>> keyValues = Singleton<DataManager>.Instance.GetDBRecorderList(); SortedDictionary<string, Func<object>> keyValues = Singleton<DataManager>.Instance.GetDBRecorderList();