|
@@ -83,9 +83,6 @@ namespace BPASmart.Server |
|
|
} |
|
|
} |
|
|
}), $"{item.DeviceName} 初始化连接"); |
|
|
}), $"{item.DeviceName} 初始化连接"); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private void SetValue<TArray>(TArray[] arrays, string DeviceName, ReadDataModel readDataModel, ushort by) |
|
|
private void SetValue<TArray>(TArray[] arrays, string DeviceName, ReadDataModel readDataModel, ushort by) |
|
@@ -101,14 +98,23 @@ namespace BPASmart.Server |
|
|
int varIndex = Array.FindIndex(tempArray, p => p.RealAddress == readDataModel.StartAddress + (i * by)); |
|
|
int varIndex = Array.FindIndex(tempArray, p => p.RealAddress == readDataModel.StartAddress + (i * by)); |
|
|
if (varIndex >= 0 && varIndex < tempArray.Length) |
|
|
if (varIndex >= 0 && varIndex < tempArray.Length) |
|
|
{ |
|
|
{ |
|
|
var Devicename = Json<CommunicationPar>.Data.CommunicationDevices[index].DeviceName; |
|
|
|
|
|
var varname = Json<CommunicationPar>.Data.CommunicationDevices[index].VarTableModels[varIndex].VarName; |
|
|
|
|
|
RedisHelper.GetInstance.SetValue($"{Devicename}.{varname}", arrays[i]); |
|
|
|
|
|
|
|
|
|
|
|
Json<CommunicationPar>.Data.CommunicationDevices.ElementAt(index).VarTableModels.ElementAt(varIndex).CurrentValue = arrays[i].ToString(); |
|
|
Json<CommunicationPar>.Data.CommunicationDevices.ElementAt(index).VarTableModels.ElementAt(varIndex).CurrentValue = arrays[i].ToString(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var Devicename = Json<CommunicationPar>.Data.CommunicationDevices[index].DeviceName; |
|
|
|
|
|
List<ReeisDataModel> reeisDataModels = new List<ReeisDataModel>(); |
|
|
|
|
|
Json<CommunicationPar>.Data.CommunicationDevices[index].VarTableModels.ToList().ForEach(tempVar => |
|
|
|
|
|
{ |
|
|
|
|
|
if (tempVar.VarName.Length > 0) |
|
|
|
|
|
{ |
|
|
|
|
|
reeisDataModels.Add(new ReeisDataModel() |
|
|
|
|
|
{ |
|
|
|
|
|
VarName = tempVar.VarName, |
|
|
|
|
|
VarVaule = tempVar.CurrentValue |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
RedisHelper.GetInstance.SetValue($"{Devicename}", reeisDataModels); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|