标签变量参数更改
This commit is contained in:
@@ -116,6 +116,42 @@ namespace CapMachine.Wpf.Models.Tag
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ******* 从ShortValueTag中获取PVModel模型-定制的 ********
|
||||
/// 需要提前知道这个标签是CapTag标签,否则为空
|
||||
/// 尝试获取CapTag标签的PVModel模型
|
||||
/// 压缩机通信的标签
|
||||
/// </summary>
|
||||
/// <param name="tagName">标签名称</param>
|
||||
/// <param name="pVModel">输出的pVModel模型,如果获取失败则为null</param>
|
||||
/// <returns>是否成功获取PV模型</returns>
|
||||
public bool TryGetCapPVModelByShortValueTag(string tagName, out MeterValueAttrCell? pVModel)
|
||||
{
|
||||
lock (PvLock)
|
||||
{
|
||||
pVModel = null;
|
||||
|
||||
if (string.IsNullOrEmpty(tagName))
|
||||
return false;
|
||||
|
||||
// 尝试从字典中获取标签
|
||||
if (DicTags.TryGetValue(tagName, out var tag))
|
||||
{
|
||||
// 尝试将标签转换为ShortValueTag
|
||||
if (tag is ShortValueTag capTag)
|
||||
{
|
||||
pVModel = capTag.PVModel;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 尝试获取标签的PVModel模型
|
||||
|
||||
@@ -1413,7 +1413,7 @@ namespace CapMachine.Wpf.Services
|
||||
|
||||
while (ThreadEnable)
|
||||
{
|
||||
await Task.Delay(20);
|
||||
await Task.Delay(100);
|
||||
//await Task.CompletedTask;
|
||||
|
||||
DiagnosticsTime.Reset();
|
||||
@@ -1467,7 +1467,7 @@ namespace CapMachine.Wpf.Services
|
||||
if (itemCanLinGroup.Value.Group == "压缩机")
|
||||
{
|
||||
//尝试获取模型信息
|
||||
if (TagManger.TryGetCapPVModel(itemCanLinGroup.Key, out QuickAttrCell? pVModel))
|
||||
if (TagManger.TryGetCapPVModelByShortValueTag(itemCanLinGroup.Key, out MeterValueAttrCell? pVModel))
|
||||
{
|
||||
switch (ConfigService.CanLinRunStateModel.CurSysSelectedCanLin)
|
||||
{
|
||||
@@ -1490,6 +1490,7 @@ namespace CapMachine.Wpf.Services
|
||||
SiemensDrive.Write(pVModel!.Address!.Replace("W", ""), (short)(LinDriveService.GetLdfValueByName(itemCanLinGroup.Value.NameNoUnit) * itemCanLinGroup.Value.Precision));
|
||||
break;
|
||||
case CanLinEnum.No:
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user