فهرست منبع

1. 调试日志88的处理完善
2. 修改标准值后,重新判断相等的bug修复

djs 5 ماه پیش
والد
کامیت
abb4935a5f

+ 2 - 0
MeterVision/Dlg/EditSingleConfig.xaml.cs

@@ -34,6 +34,8 @@ namespace MeterVision.Dlg
             cmbMeterType.ItemsSource = StationItem.MeterTypeList;
             cmbFlowRate.ItemsSource = StationItem.FlowRateList;
             cmbLastUnit.ItemsSource = StationItem.UnitList;
+            cmbNumCount.ItemsSource = StationItem.NumList;
+            cmbIndCount.ItemsSource = StationItem.NumList;
 
             mDetailItem = detailItem;
             Init_Load(detailItem);

+ 2 - 2
MeterVision/Patch/UCPatchGrid.xaml.cs

@@ -341,9 +341,9 @@ namespace MeterVision.Patch
                 }
                 else
                 {
-                    if (int.TryParse(standValueModel.StandValue, out int iStandValue))
+                    if (double.TryParse(standValueModel.StandValue, out double dStandValue))
                     {
-                        equalFlag = detailItem.GetEqualFlag(iStandValue, detailItem.FinalValue);
+                        equalFlag = detailItem.GetEqualFlag(dStandValue, detailItem.FinalValue);
                     }
                 }
                 

+ 41 - 0
MeterVision/ThisApp.cs

@@ -271,6 +271,47 @@ namespace MeterVision
                 //throw new FormatException("The input string is not a valid integer.");
             }
         }
+
+        //去除数组中的88,替换为""
+        public static string GetDebugInfos(byte[] infoBytes)
+        {
+            if(infoBytes == null || infoBytes.Length != 24)
+            {
+                return "";
+            }
+
+            //List<string> infoList = new List<string>();
+            string[] infos = new string[24];
+
+            for (int i = 0; i < 24; i++)
+            {
+                if (i < 12 && infoBytes[i] == 88 && infoBytes[i + 12] == 88)
+                {
+                    //infoList.Insert(i, "");
+                    //infoList.Insert(i + 12, "");
+                    infos[i] = "";
+                    //infos[i + 12] = "";
+                    continue;
+                }
+                else if (i > 12 && infoBytes[i] == 88 && infoBytes[i - 12] == 88)
+                {
+                    infos[i] = "";
+                }
+                else
+                {
+                    infos[i] = infoBytes[i].ToString();
+                }
+                if (infos[i].Length == 1)
+                {
+                    infos[i] = "0" + infos[i];
+                }
+                //infoList.Insert(i, infoBytes[i].ToString());                
+            }
+
+            return string.Join(",", infos);
+            
+        }
+
         //////////////////////////////////////////////////////
 
     }

+ 4 - 4
MeterVision/db/TPatchDetail.cs

@@ -113,8 +113,8 @@ namespace MeterVision.db
             LogPath = resultModel.LogPath;
 
             // 使用 LINQ 进行转换和条件判断
-            var formattedBytes = resultModel.DebugInfoBytes.Select(b => b == 88 ? "" : b.ToString());
-            DebugInfo = string.Join(",", formattedBytes);
+            //var formattedBytes = resultModel.DebugInfoBytes.Select(b => b == 88 ? "" : b.ToString());
+            DebugInfo = ThisApp.GetDebugInfos(resultModel.DebugInfoBytes);  //string.Join(",", formattedBytes);
 
             //EqualFlag,这里需要判断,是否相等、约等、不等
             //先简单判断
@@ -151,8 +151,8 @@ namespace MeterVision.db
             LogPath = resultModel.LogPath;
 
             // 使用 LINQ 进行转换和条件判断
-            var formattedBytes = resultModel.DebugInfoBytes.Select(b => b == 88 ? "" : b.ToString());
-            DebugInfo = string.Join(",", formattedBytes);
+            //var formattedBytes = resultModel.DebugInfoBytes.Select(b => b == 88 ? "" : b.ToString());
+            DebugInfo = ThisApp.GetDebugInfos(resultModel.DebugInfoBytes); //string.Join(",", formattedBytes);
 
             //EqualFlag,这里需要判断,是否相等、约等、不等
             //先简单判断

+ 3 - 2
MeterVision/db/TSingleDetail.cs

@@ -101,8 +101,9 @@ namespace MeterVision.db
 
 
             // 使用 LINQ 进行转换和条件判断
-            var formattedBytes = resultModel.DebugInfoBytes.Select(b => b == 88 ? "" : b.ToString());
-            DebugInfo = string.Join(",", formattedBytes);
+            //var formattedBytes = resultModel.DebugInfoBytes.Select(b => b == 88 ? "" : b.ToString());
+            //DebugInfo = string.Join(",", formattedBytes);
+            DebugInfo = ThisApp.GetDebugInfos(resultModel.DebugInfoBytes);
         }
 
         /////////////////////////////////////////////////////////

+ 34 - 24
MeterVision/model/PatchDetailItem.cs

@@ -962,39 +962,49 @@ namespace MeterVision.model
 
         private string[] Get_DebugInfoArray()
         {
-            //string[] sInfos = DebugInfo.Split(',');
-            //if (sInfos.Length != 24)
-            //{
-            //    sInfos = Enumerable.Range(0, 24).Select(_ => "").ToArray();
-            //}
-
-            //return sInfos.Select(s => s == "88" ? "" : s).ToArray();
 
-            // 将 DebugInfo 按逗号分割成字符串数组
             string[] sInfos = DebugInfo.Split(',');
-
-            // 如果数组长度不等于24,则创建一个新的长度为24的数组并初始化为空字符串
             if (sInfos.Length != 24)
             {
                 sInfos = Enumerable.Range(0, 24).Select(_ => "").ToArray();
             }
 
-            // 对每个字符串进行处理:如果它是 "88" 则转为空字符串,
-            // 如果它是单个数字,则在前面补零
-            return sInfos.Select(s =>
-            {
-                // 如果是 "88" 返回空字符串
-                if (s == "88") return "";
+            return sInfos.ToArray();
 
-                // 如果字符串长度为1,则在前面补零
-                if (s.Length == 1)
-                {
-                    return "0" + s;
-                }
 
-                // 否则返回原字符串
-                return s;
-            }).ToArray();
+            ////string[] sInfos = DebugInfo.Split(',');
+            ////if (sInfos.Length != 24)
+            ////{
+            ////    sInfos = Enumerable.Range(0, 24).Select(_ => "").ToArray();
+            ////}
+
+            ////return sInfos.Select(s => s == "88" ? "" : s).ToArray();
+
+            //// 将 DebugInfo 按逗号分割成字符串数组
+            //string[] sInfos = DebugInfo.Split(',');
+
+            //// 如果数组长度不等于24,则创建一个新的长度为24的数组并初始化为空字符串
+            //if (sInfos.Length != 24)
+            //{
+            //    sInfos = Enumerable.Range(0, 24).Select(_ => "").ToArray();
+            //}
+
+            //// 对每个字符串进行处理:如果它是 "88" 则转为空字符串,
+            //// 如果它是单个数字,则在前面补零
+            //return sInfos.Select(s =>
+            //{
+            //    // 如果是 "88" 返回空字符串
+            //    if (s == "88") return "";
+
+            //    // 如果字符串长度为1,则在前面补零
+            //    if (s.Length == 1)
+            //    {
+            //        return "0" + s;
+            //    }
+
+            //    // 否则返回原字符串
+            //    return s;
+            //}).ToArray();
         }
 
         public string GetValueByLastUnit(long value)

+ 2 - 1
MeterVision/model/SingleDetailItem.cs

@@ -580,7 +580,8 @@ namespace MeterVision.model
                 sInfos = Enumerable.Range(0, 24).Select(_ => "").ToArray();
             }
 
-            return sInfos.Select(s => s == "88" ? "" : s).ToArray();
+            return sInfos.ToArray();
+            //return sInfos.Select(s => s == "88" ? "" : s).ToArray();
         }