From 2e889843b4c171f2d6ad8e0d53084040703d11f6 Mon Sep 17 00:00:00 2001
From: wenxiangchao <wenxiangchao@ihengxin.com.cn>
Date: 星期一, 09 十一月 2026 13:18:21 +0800
Subject: [PATCH] docs: CAN 总线级应答器 + 硬件调试页多标签多会话 设计规格

---
 SimpleUtil/HMI.Simple.Util/ProductUtil.cs |   89 ++++++++++++++++++++++++++++++++++++++------
 1 files changed, 76 insertions(+), 13 deletions(-)

diff --git a/SimpleUtil/HMI.Simple.Util/ProductUtil.cs b/SimpleUtil/HMI.Simple.Util/ProductUtil.cs
index a6969e3..fe8c631 100644
--- a/SimpleUtil/HMI.Simple.Util/ProductUtil.cs
+++ b/SimpleUtil/HMI.Simple.Util/ProductUtil.cs
@@ -10,22 +10,86 @@
         private static void WriteParameterData(object instance, ParameterData data)
         {
             SequenceContext context = (SequenceContext)instance;
-            if (data.Type == "Bool")
+            string name = $"DUTSetting.{data.Name}";
+
+            if (data.IsArray)
             {
-                context.FileGlobals.SetValBoolean($"DUTSetting.{data.Name}", 1, bool.Parse(data.Value));
-            }
-            else if (data.Type == "Int")
-            {
-                context.FileGlobals.SetValInteger64($"DUTSetting.{data.Name}", 1, int.Parse(data.Value));
-            }
-            else if (data.Type == "Double")
-            {
-                context.FileGlobals.SetValNumber($"DUTSetting.{data.Name}", 1, double.Parse(data.Value));
+                PropertyValueTypes type;
+                if (data.Type == "Bool")
+                {
+                    type = PropertyValueTypes.PropValType_Boolean;
+                }
+                else if (data.Type == "Int")
+                {
+                    type = PropertyValueTypes.PropValType_Number;
+                }
+                else if (data.Type == "Double")
+                {
+                    type = PropertyValueTypes.PropValType_Number;
+                }
+                else
+                {
+                    type = PropertyValueTypes.PropValType_String;
+                }
+                string[] arr = data.Value?.Split(',') ?? new string[0];
+                if (arr.Length > 0)
+                {
+                    context.FileGlobals.DeleteSubProperty(name, 2);
+
+                    context.FileGlobals.NewSubProperty(name, type, true, null, 1);
+                    context.FileGlobals.GetPropertyObject(name, 0).SetNumElements(arr.Length);
+                    for (int i = 0; i < arr.Length; i++)
+                    {
+                        if (type == PropertyValueTypes.PropValType_String)
+                        {
+                            context.FileGlobals.SetValString($"{name}[{i}]", 0, arr[i]);
+                        }
+                        if (data.Type == "Int")
+                        {
+                            context.FileGlobals.SetValNumber($"{name}[{i}]", 0, int.Parse(arr[i]));
+                        }
+                        if (data.Type == "Double")
+                        {
+                            context.FileGlobals.SetValNumber($"{name}[{i}]", 0, double.Parse(arr[i]));
+                        }
+                        if (data.Type == "Bool")
+                        {
+                            context.FileGlobals.SetValBoolean($"{name}[{i}]", 0, bool.Parse(arr[i]));
+                        }
+                    }
+                }
             }
             else
             {
-                context.FileGlobals.SetValString($"DUTSetting.{data.Name}", 1, data.Value);
+                if (data.Type == "Bool")
+                {
+                    context.FileGlobals.SetValBoolean(name, 1, bool.Parse(data.Value));
+                }
+                else if (data.Type == "Int")
+                {
+                    context.FileGlobals.SetValNumber(name, 1, int.Parse(data.Value));
+                }
+                else if (data.Type == "Double")
+                {
+                    context.FileGlobals.SetValNumber(name, 1, double.Parse(data.Value));
+                }
+                else
+                {
+                    context.FileGlobals.SetValString(name, 1, data.Value);
+                }
             }
+
+
+        }
+
+        private static string GetDataFilePath()
+        {
+            string path = ParameterUtil.GetCommonParameterValue("ShareConfig", out _);
+            if (path == null)
+            {
+                path = Path.Combine(RegUtil.GetLocaltion(), "Config");
+            }
+            return path;
         }
 
         /// <summary>
@@ -40,8 +104,7 @@
             errMsg = string.Empty;
             try
             {
-                string dir = RegUtil.GetLocaltion();
-                string path = Path.Combine(dir, "Config", "Product", "Parameter", $"Parameter_{model}.data");
+                string path = Path.Combine(GetDataFilePath(), "Product", "Parameter", $"Parameter_{model}.data");
                 return WriteConfigToContextByPath(path, instance, out errMsg);
             }
             catch (Exception ex)

--
Gitblit v1.9.1