添加S7后台服务和添加PLC所需要的属性

This commit is contained in:
2025-07-05 01:31:44 +08:00
parent 69b75ef228
commit 404501cc17
8 changed files with 295 additions and 1 deletions

View File

@@ -51,4 +51,20 @@ public static class SiemensHelper
return "object";
}
}
/// <summary>
/// 将S7读取到的值转换为显示值
/// </summary>
/// <param name="value">S7读取到的原始值</param>
/// <param name="dataType">变量的数据类型</param>
/// <param name="conversion">转换规则</param>
/// <returns>显示值</returns>
public static string ConvertS7Value(object value, string dataType, string conversion)
{
if (value == null) return string.Empty;
// For now, a simple conversion to string. More complex logic can be added here.
// Based on dataType and conversion, you might parse, format, or apply formulas.
return value.ToString();
}
}