From 43a419fd5c028106f44b851b99259fc39526f550 Mon Sep 17 00:00:00 2001 From: fyf Date: Fri, 27 May 2022 11:52:53 +0800 Subject: [PATCH] gengx --- BPASmartClient.IoT/DataVClient.cs | 36 ++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/BPASmartClient.IoT/DataVClient.cs b/BPASmartClient.IoT/DataVClient.cs index 45722f69..a560ca08 100644 --- a/BPASmartClient.IoT/DataVClient.cs +++ b/BPASmartClient.IoT/DataVClient.cs @@ -41,7 +41,18 @@ namespace BPASmartClient.IoT DeviceSecret = System.Configuration.ConfigurationManager.AppSettings["DeviceSecret"].ToString(); StartupMode = System.Configuration.ConfigurationManager.AppSettings["StartupMode"].ToString(); BroadcastPubTopic = InternetInfo.BroadcastPubTopic; - BroadcastMaintainPubTopic = $"{InternetInfo.BroadcastPubTopic}Maintain"; + + + //MaintainTable maintainTable = new MaintainTable(); + //maintainTable.Id = Guid.NewGuid().ToString(); + //maintainTable.MaintainTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + //maintainTable.MaintainType = "一般"; + //maintainTable.MaintainVla = "MorkS"; + //maintainTable.MaintainMessage = "xxxxx故障需要维修"; + //maintainTable.DeviceId = ""; + //maintainTable.ClientId = ClientId; + //maintainTable.devicename = DeviceDataV.deviceTable.devicename; + //maintainTables.Add(maintainTable); } #endregion @@ -51,7 +62,6 @@ namespace BPASmartClient.IoT public string ProductKey { set; get; } public string DeviceSecret { set; get; } public string BroadcastPubTopic { set; get; } - public string BroadcastMaintainPubTopic { set; get; } /// /// DataV 服务地址 /// @@ -112,18 +122,15 @@ namespace BPASmartClient.IoT { if (DeviceDataV != null && DeviceDataV.GetIsConnected() && DeviceDataV.deviceTable != null) { - // AlarmTime = GetPropertyValue(obj, "Time").ToString(), - //AlarmType = GetPropertyValue(obj, "Type").ToString(), - //AlarmMessage = GetPropertyValue(obj, "Text").ToString(), - //AlarmVla = "告警", - //DeviceId = Devid.ToString(), - //KeyID = id, - maintainTable.MaintainTime = DateTime.Now.ToString(); - maintainTable.MaintainType = "一般"; - maintainTable.MaintainVla = "维修"; + maintainTable.Id=Guid.NewGuid().ToString(); + //maintainTable.MaintainTime = DateTime.Now.ToString(); + //maintainTable.MaintainType = "一般"; + //maintainTable.MaintainVla = "MorkS"; + //maintainTable.MaintainMessage = "xxxxx故障需要维修"; + //maintainTable.DeviceId = ""; maintainTable.ClientId = ClientId; maintainTable.devicename = DeviceDataV.deviceTable.devicename; - DeviceDataV.IOT_Publish(BroadcastMaintainPubTopic, Tools.JsonConvertTools(maintainTable)); + maintainTables.Add(maintainTable); } } catch (Exception ex) @@ -243,7 +250,10 @@ namespace BPASmartClient.IoT }); if (dataVNode.Count > 0) { - iOTDevSXModel.Maintain= Tools.JsonConvertTools(maintainTables); + if (maintainTables.Count > 0) + { + iOTDevSXModel.Maintain = Tools.JsonConvertTools(maintainTables); + } iOTDevSXModel.NodeStatus = Tools.JsonConvertTools(new { data = dataVNode }); DeviceDataV.IOT_Publish(DeviceDataV.PubTopic, iOTDevSXModel.Tojson()); }