Compare commits

..

1 Commits

Author SHA1 Message Date
Diego
ab1b364c54 fix: 同步插件反写空错误 2025-05-28 12:30:16 +08:00
4 changed files with 14 additions and 11 deletions

View File

@@ -1,8 +1,8 @@
<Project>
<PropertyGroup>
<PluginVersion>10.6.29</PluginVersion>
<ProPluginVersion>10.6.29</ProPluginVersion>
<PluginVersion>10.6.30</PluginVersion>
<ProPluginVersion>10.6.30</ProPluginVersion>
<AuthenticationVersion>2.1.8</AuthenticationVersion>
</PropertyGroup>

View File

@@ -132,6 +132,7 @@ public partial class Synchronization : BusinessBase, IRpcDriver
// 如果 online 为 true表示设备在线
if (online)
{
var deviceRunTimes = CollectDevices.Where(a => a.Value.IsCollect == true).Select(a => a.Value).Adapt<List<DeviceDataWithValue>>();
@@ -308,9 +309,11 @@ public partial class Synchronization : BusinessBase, IRpcDriver
a.Channel.Id = CommonUtils.GetSingleId();
a.DeviceVariables.ForEach(b =>
{
b.Device.Id = 0;
b.Device.ChannelId=a.Channel.Id;
b.Device.Id = CommonUtils.GetSingleId();
b.Variables.ForEach(c =>
{
c.DeviceId= b.Device.Id;
c.Id = 0;
});
});
@@ -340,12 +343,12 @@ public partial class Synchronization : BusinessBase, IRpcDriver
{
if (deviceDatas.TryGetValue(item.Key.DeviceName ?? string.Empty, out var variableDatas))
{
variableDatas.Add(item.Key.Name, item.Value?.ToString() ?? string.Empty);
variableDatas.TryAdd(item.Key.Name, item.Value?.ToString() ?? string.Empty);
}
else
{
deviceDatas.Add(item.Key.DeviceName ?? string.Empty, new());
deviceDatas[item.Key.DeviceName ?? string.Empty].Add(item.Key.Name, item.Value?.ToString() ?? string.Empty);
deviceDatas.TryAdd(item.Key.DeviceName ?? string.Empty, new());
deviceDatas[item.Key.DeviceName ?? string.Empty].TryAdd(item.Key.Name, item.Value?.ToString() ?? string.Empty);
}
}
@@ -402,7 +405,7 @@ public partial class Synchronization : BusinessBase, IRpcDriver
try
{
var data = await _tcpDmtpClient.GetDmtpRpcActor().InvokeTAsync<Dictionary<string, Dictionary<string, OperResult<object>>>>(
var data = await client.GetDmtpRpcActor().InvokeTAsync<Dictionary<string, Dictionary<string, OperResult<object>>>>(
nameof(ReverseCallbackServer.Rpc), waitInvoke, new Dictionary<string, Dictionary<string, string>>() { { item.Key, item.Value } }).ConfigureAwait(false);
dataResult.AddRange(data);
@@ -415,7 +418,7 @@ public partial class Synchronization : BusinessBase, IRpcDriver
foreach (var vItem in item.Value)
{
dataResult[item.Key].Add(vItem.Key, new OperResult<object>(ex));
dataResult[item.Key].TryAdd(vItem.Key, new OperResult<object>(ex));
}
}
}
@@ -426,7 +429,7 @@ public partial class Synchronization : BusinessBase, IRpcDriver
foreach (var vItem in item.Value)
{
dataResult[item.Key].Add(vItem.Key, new OperResult<object>("No online"));
dataResult[item.Key].TryAdd(vItem.Key, new OperResult<object>("No online"));
}
}

View File

@@ -15,7 +15,7 @@ namespace ThingsGateway.Plugin.Synchronization;
/// <summary>
/// <inheritdoc/>
/// </summary>
public class SynchronizationProperty : BusinessPropertyBase
public class SynchronizationProperty : BusinessPropertyBase, IBusinessPropertyAllVariableBase
{
[DynamicProperty]
public bool IsServer { get; set; } = true;

View File

@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Version>10.6.29</Version>
<Version>10.6.30</Version>
</PropertyGroup>
<ItemGroup>