opcuaServer支持decimal类型

This commit is contained in:
Diego
2025-07-08 16:53:28 +08:00
parent 044e78bea9
commit dbee8496cb
3 changed files with 7 additions and 4 deletions

View File

@@ -1,9 +1,9 @@
<Project>
<PropertyGroup>
<PluginVersion>10.9.27</PluginVersion>
<PluginVersion>10.9.28</PluginVersion>
<ProPluginVersion>10.9.26</ProPluginVersion>
<DefaultVersion>10.9.27</DefaultVersion>
<DefaultVersion>10.9.28</DefaultVersion>
<AuthenticationVersion>2.9.13</AuthenticationVersion>
<SourceGeneratorVersion>10.9.13</SourceGeneratorVersion>
<NET8Version>8.0.17</NET8Version>

View File

@@ -116,7 +116,8 @@ public static class JsonUtils
case BuiltInType.Int64: { return decoder.ReadInt64(fieldName); }
case BuiltInType.UInt64: { return decoder.ReadUInt64(fieldName); }
case BuiltInType.Float: { return decoder.ReadFloat(fieldName); }
case BuiltInType.Double: { return decoder.ReadDouble(fieldName); }
case BuiltInType.Double:
case BuiltInType.Number: { return decoder.ReadDouble(fieldName); }
case BuiltInType.String:
{
if (decoder.ReadField(fieldName, out var value))
@@ -288,7 +289,7 @@ public static class JsonUtils
}
case BuiltInType.Number:
{
encoder.WriteInt64(fieldName, Convert.ToInt64(value));
encoder.WriteDouble(fieldName, Convert.ToInt64(value));
return;
}
case BuiltInType.UInteger:

View File

@@ -287,6 +287,8 @@ public class ThingsGatewayNodeManager : CustomNodeManager2
return DataTypeIds.String;
if (tp == typeof(DateTime))
return DataTypeIds.DateTime;
if (tp == typeof(decimal))
return DataTypeIds.Decimal;
return DataTypeIds.String;
}