Explorar el Código

更新Web异常。

Klosszhu hace 2 años
padre
commit
b311b70ad0
Se han modificado 1 ficheros con 39 adiciones y 9 borrados
  1. 39 9
      YS.Start.AdminLine/Core/App/Common/AppUtil.cs

+ 39 - 9
YS.Start.AdminLine/Core/App/Common/AppUtil.cs

@@ -499,12 +499,12 @@ public static class AppUtil
         List<DataItem> list = JsonUtil.DeserializeObject<List<DataItem>>(str);
         foreach (var item in list)
         {
-            if (item.TagAddress.EndsWith(".F_CV"))
+            if (item.TagAddress.ToUpper().EndsWith(".F_CV"))
             {
                 DataItem dataItem = null;
                 if (AppUtil.DataItemQueue.TryGetValue(item.TagAddress, out dataItem))
                 {
-                    if (float.Parse(item.Value.ToString()) == (float)dataItem.Value)
+                    if (Convert.ToDouble(item.Value.ToString()) == Convert.ToDouble(dataItem.Value.ToString()))
                     {
                         result.Add(true);
                         dataItem.IsSetSuccessful = true;
@@ -518,11 +518,15 @@ public static class AppUtil
                 }
 
             }
-            else if (item.TagAddress.EndsWith(".A_CV"))
+            else if (item.TagAddress.ToUpper().EndsWith(".A_CV"))
             {
                 DataItem dataItem = null;
                 if (AppUtil.DataItemQueue.TryGetValue(item.TagAddress, out dataItem))
                 {
+                    if (item.Value == null)
+                    {
+                        item.Value = "";
+                    }
                     if (item.Value.ToString() == dataItem.Value.ToString())
                     {
                         result.Add(true);
@@ -539,7 +543,6 @@ public static class AppUtil
         }
         return result;
     }
-
     public static List<DataItem> ReadList(string str)   //读取多个标签
     {
         //List<string> tags = JsonUtil.DeserializeObject<List<string>>(str);
@@ -547,22 +550,49 @@ public static class AppUtil
         List<DataItem> rlt = new List<DataItem>();
         foreach (var item in list)
         {
-            if (item.TagAddress.EndsWith(".F_CV"))
+            if (item.TagAddress.ToUpper().EndsWith(".F_CV"))
             {
+                var itemvalue = Convert.ToDouble(Read<float>(item.TagAddress));
+                bool results = false;
+                if (true)
+                {
+                    var r = list.FirstOrDefault(a => a.TagAddress.ToUpper() == item.TagAddress.ToUpper());
+                    if (r != null)
+                    {
+                        if (Convert.ToDouble(r.Value) == itemvalue)
+                        {
+                            results = true;
+                        }
+                    }
+                }
                 rlt.Add(new DataItem()
                 {
                     TagAddress = item.TagAddress,
-                    Value = Read<float>(item.TagAddress),
-
+                    Value = itemvalue,
+                    IsSetSuccessful = results
                 });
             }
-            else if (item.TagAddress.EndsWith(".A_CV"))
+            else if (item.TagAddress.ToUpper().EndsWith(".A_CV"))
             {
+
+                var itemvalue = Read<string>(item.TagAddress);
+                bool results = false;
+                if (true)
+                {
+                    var r = list.FirstOrDefault(a => a.TagAddress.ToUpper() == item.TagAddress.ToUpper());
+                    if (r != null)
+                    {
+                        if (r.Value.ToString() == itemvalue)
+                        {
+                            results = true;
+                        }
+                    }
+                }
                 rlt.Add(new DataItem()
                 {
                     TagAddress = item.TagAddress,
                     Value = Read<string>(item.TagAddress),
-
+                    IsSetSuccessful = results
                 });
 
             }