From 91a89e128005b5d6460f61b743654e42585429c3 Mon Sep 17 00:00:00 2001
From: tangxu <76880903@qq.com>
Date: 星期一, 14 十一月 2022 14:04:57 +0800
Subject: [PATCH] 优化成行二取

---
 Api/IStation.DataDockingApi4Ys/HandleHelper.cs |   32 +++++++++++++++-----------------
 1 files changed, 15 insertions(+), 17 deletions(-)

diff --git a/Api/IStation.DataDockingApi4Ys/HandleHelper.cs b/Api/IStation.DataDockingApi4Ys/HandleHelper.cs
index f014373..d7116c8 100644
--- a/Api/IStation.DataDockingApi4Ys/HandleHelper.cs
+++ b/Api/IStation.DataDockingApi4Ys/HandleHelper.cs
@@ -25,7 +25,7 @@
             var appParas = AppParasHelper.Get();
             if (appParas == null)
             {
-                LogHelper.Info("涓婃捣鍩庢姇鍘熸按 Api 鏁版嵁瀵规帴涓紝缂哄皯瀵规帴閰嶇疆鏂囦欢");
+                LogHelper.Error("涓婃捣鍩庢姇鍘熸按 Api 鏁版嵁瀵规帴涓紝缂哄皯瀵规帴閰嶇疆鏂囦欢");
                 return;
             }
             var url = appParas.url + Guid.NewGuid().ToString("N");
@@ -60,11 +60,11 @@
                     }
                     else
                     {
-                        var record_list = dict.Select(x => x.Value).ToList();
-                        var receive_list = new List<Model.MonitorDataDockingReceiveRecord>();
+                        var recordList = dict.Select(x => x.Value).ToList();
+                        var receiveList = new List<Model.MonitorDataDockingReceiveRecord>();
                         foreach (var mapper in mappers)
                         {
-                            var src = record_list.Find(x=>x.key==mapper.SignId);
+                            var src = recordList.Find(x=>x.key==mapper.SignId);
                             if (src != null)
                             {
                                 var recordContent = JsonHelper.Json2Object<RecordContent>(src.vals);
@@ -72,29 +72,27 @@
                                 {
                                     if (DateTime.TryParse(recordContent.time, out DateTime time_result))
                                     {
-                                        if (double.TryParse(recordContent.value, out double value_result))
+                                        var receiveRecord = new Model.MonitorDataDockingReceiveRecord()
                                         {
-                                            var receiveRecord = new Model.MonitorDataDockingReceiveRecord()
-                                            {
-                                                SysId = mapper.SysId,
-                                                RecordType = Model.eMonitorType.General,
-                                                SrcTime = time_result,
-                                                SrcValue = value_result.ToString(),
-                                            };
-                                            receive_list.Add(receiveRecord);
-                                        }
+                                            SysId = mapper.SysId,
+                                            RecordType = Model.eMonitorType.General,
+                                            SrcTime = time_result,
+                                            SrcValue = recordContent.value
+                                        };
+                                        receiveList.Add(receiveRecord);
                                     }
-
                                 }
                             }
                         }
-                        receive(receive_list);
+                        receive(receiveList);
 
                         #region 鐢熸垚璋冭瘯璁板綍
+
                         if (appParas.debug)
                         {
-                            DebugHelper.Debug(record_list);
+                            DebugHelper.Debug(recordList);
                         }
+
                         #endregion
                     }
                     webSocket4Net.Close();

--
Gitblit v1.9.3