From 75d1950a9c3d8a32090bd95cea271ec36e7c09dc Mon Sep 17 00:00:00 2001
From: C3204 <zhengyabo@lanpucloud.cn>
Date: 星期三, 07 一月 2026 12:47:41 +0800
Subject: [PATCH] 增加通讯按钮菜单到编辑流程。

---
 LB_SmartVision/Forms/Pages/CommunicatorPage/CommunicatorsEditPage.cs     |   10 +
 LB_SmartVision/VisionForm.cs                                             |  171 ++++++++++++++++++++++++----------
 LB_VisionProcesses/Communicators/CommunicatorConfig.cs                   |    4 
 LB_VisionProcesses/Communicators/CommunicatorForm.resx                   |    2 
 LB_VisionProcesses/Communicators/CommunicatorForm.Designer.cs            |   28 +++++
 LB_SmartVision/Forms/Pages/CommunicatorPage/CreateCommunicatorForm.cs    |    4 
 LB_SmartVision/ProcessRun/ProcessContext.cs                              |    2 
 LB_SmartVision/Forms/Pages/CommunicatorPage/CommunicatorForm.Designer.cs |    1 
 LB_SmartVision/Forms/Pages/CommunicatorPage/CommunicatorForm.cs          |   47 +++++++++
 LB_VisionFlowNode/IFlowContext.cs                                        |    3 
 LB_VisionProcesses/Communicators/CommunicatorForm.cs                     |   20 +++
 11 files changed, 229 insertions(+), 63 deletions(-)

diff --git a/LB_SmartVision/Forms/Pages/CommunicatorPage/CommunicatorForm.Designer.cs b/LB_SmartVision/Forms/Pages/CommunicatorPage/CommunicatorForm.Designer.cs
index e470852..e008eb3 100644
--- a/LB_SmartVision/Forms/Pages/CommunicatorPage/CommunicatorForm.Designer.cs
+++ b/LB_SmartVision/Forms/Pages/CommunicatorPage/CommunicatorForm.Designer.cs
@@ -150,6 +150,7 @@
             txtAddress.Name = "txtAddress";
             txtAddress.Size = new Size(100, 21);
             txtAddress.TabIndex = 9;
+            txtAddress.TextChanged += txtAddress_TextChanged;
             // 
             // cmbType
             // 
diff --git a/LB_SmartVision/Forms/Pages/CommunicatorPage/CommunicatorForm.cs b/LB_SmartVision/Forms/Pages/CommunicatorPage/CommunicatorForm.cs
index 08c07a7..0e70eb0 100644
--- a/LB_SmartVision/Forms/Pages/CommunicatorPage/CommunicatorForm.cs
+++ b/LB_SmartVision/Forms/Pages/CommunicatorPage/CommunicatorForm.cs
@@ -3,13 +3,26 @@
 using LB_VisionProcesses.Communicators.TCom;
 using ReaLTaiizor.Forms;
 using RJCP.IO.Ports;
+using S7.Net;
 using System.Diagnostics;
+using System.Linq;
 
 namespace LB_SmartVision.Forms.Pages.CommunicatorPage
 {
+    public delegate void CommunicatorChange(BaseCommunicator communicator);
     public partial class CommunicatorForm : Form
     {
         BaseCommunicator communicator { get; set; }
+
+        public event CommunicatorChange CommunicatorChanged;
+
+        private void communicatorChanged(BaseCommunicator communicator)
+        {
+            if (CommunicatorChanged != null)
+            {
+                CommunicatorChanged(communicator);
+            }
+        }
 
         public CommunicatorForm()
         {
@@ -54,6 +67,9 @@
                 txtIP.Visible = false;
                 cmbIP.Visible = true;
 
+                this.btnRuleSend.Visible = true;
+
+
                 lblType.Visible = false;
                 lblAddress.Visible = false;
                 cmbType.Visible = false;
@@ -68,6 +84,9 @@
                 txtPort.SelectedText = communicator.CommunicatorConnections["绔彛"]?.ToString();
                 txtIP.Visible = true;
                 cmbIP.Visible = false;
+
+                this.btnRuleSend.Visible = false;
+
 
                 lblType.Visible = false;
                 lblAddress.Visible = false;
@@ -86,10 +105,15 @@
                 if (!string.IsNullOrEmpty(communicator.CommunicatorConnections["鍨嬪彿"]?.ToString()))
                 {
                     cmbType.Items.Add(communicator.CommunicatorConnections["鍨嬪彿"]?.ToString());
+                    cmbType.Text = communicator.CommunicatorConnections["鍨嬪彿"]?.ToString();
                 }
-                cmbType.Text = communicator.CommunicatorConnections["鍨嬪彿"]?.ToString();
+                if (!string.IsNullOrEmpty(communicator.CommunicatorConnections["鍙橀噺鍦板潃"]?.ToString()))
+                {
+                    txtAddress.Text = communicator.CommunicatorConnections["鍙橀噺鍦板潃"]?.ToString();
+                }
                 txtIP.Visible = true;
                 cmbIP.Visible = false;
+                this.btnRuleSend.Visible = false;
 
                 lblType.Visible = true;
                 lblAddress.Visible = true;
@@ -115,6 +139,14 @@
                     return;
                 //鍙栨秷鍥炶皟鍑芥暟
                 communicator.MessageReceived -= ShowReceiveMsg;
+                if (communicator != null)
+                {
+                    communicatorChanged(communicator);
+                    if (GlobalVar.dicCommunicators != null && GlobalVar.dicCommunicators.Keys.Count > 0 && GlobalVar.dicCommunicators.Keys.Contains(communicator.CommunicatorName))
+                    {
+                        GlobalVar.dicCommunicators[communicator.CommunicatorName] = communicator;
+                    }
+                }
             }
             catch (Exception ex)
             {
@@ -222,5 +254,18 @@
             if (communicator.SendMessage(SendMsg))
                 ShowSendMsg(SendMsg);
         }
+
+        private void txtAddress_TextChanged(object sender, EventArgs e)
+        {
+            if (communicator != null && !communicator.CommunicatorConnections.Contains("鍙橀噺鍦板潃"))
+            {
+                communicator.CommunicatorConnections.Add("鍙橀噺鍦板潃", txtAddress.Text);
+            }
+            else if (communicator != null)
+            {
+                communicator.CommunicatorConnections["鍙橀噺鍦板潃"] = txtAddress.Text;
+                communicatorChanged(communicator);
+            }
+        }
     }
 }
diff --git a/LB_SmartVision/Forms/Pages/CommunicatorPage/CommunicatorsEditPage.cs b/LB_SmartVision/Forms/Pages/CommunicatorPage/CommunicatorsEditPage.cs
index 30de3e4..0a561a3 100644
--- a/LB_SmartVision/Forms/Pages/CommunicatorPage/CommunicatorsEditPage.cs
+++ b/LB_SmartVision/Forms/Pages/CommunicatorPage/CommunicatorsEditPage.cs
@@ -126,12 +126,18 @@
 
                 if (GlobalVar.dicCommunicators.ContainsKey(name))
                 {
-                    CommunicatorForm cameraForm = new CommunicatorForm(GlobalVar.dicCommunicators[name], name);
-                    cameraForm.Show();
+                    CommunicatorForm communicatorFForm = new CommunicatorForm(GlobalVar.dicCommunicators[name], name);
+                    communicatorFForm.CommunicatorChanged += CommunicatorFForm_CommunicatorChanged;
+                    communicatorFForm.Show();
                 }
             }
         }
 
+        private void CommunicatorFForm_CommunicatorChanged(BaseCommunicator communicator)
+        {
+
+        }
+
         // 绉婚櫎閫氳鍙�
         private void DeleteEvent(string Name, string Text)
         {
diff --git a/LB_SmartVision/Forms/Pages/CommunicatorPage/CreateCommunicatorForm.cs b/LB_SmartVision/Forms/Pages/CommunicatorPage/CreateCommunicatorForm.cs
index a9fc8ab..2fbd393 100644
--- a/LB_SmartVision/Forms/Pages/CommunicatorPage/CreateCommunicatorForm.cs
+++ b/LB_SmartVision/Forms/Pages/CommunicatorPage/CreateCommunicatorForm.cs
@@ -131,7 +131,7 @@
                 MessageBox.Show("鏈�夋嫨閫氳绫诲瀷!", "寮傚父");
                 return;
             }
-            if (!communicator.Connect())
+            if (communicator.Connect())
             {
                 uiButtonCreate.Enabled = true;
                 communicator.Disconnect();
@@ -146,7 +146,7 @@
 
         private void uiButtonCreate_Click(object sender, EventArgs e)
         {
-            if (!communicator.Connect())
+            if (communicator.Connect())
             {
                 bCreate = true;
                 this.Close();
diff --git a/LB_SmartVision/ProcessRun/ProcessContext.cs b/LB_SmartVision/ProcessRun/ProcessContext.cs
index 4081006..467fd8c 100644
--- a/LB_SmartVision/ProcessRun/ProcessContext.cs
+++ b/LB_SmartVision/ProcessRun/ProcessContext.cs
@@ -573,6 +573,8 @@
         [Node("Halcon2D鏂戠偣宸ュ叿", "Haclon2D宸ュ叿", "Basic", "Halcon2D鏂戠偣宸ュ叿")]
         public void Halcon2D鏂戠偣宸ュ叿(FlowNode node) { RunNodeAsync(node); }
 
+        [Node("閫氳妯″潡", "閫氳宸ュ叿", "Basic", "閫氳妯″潡")]
+        public void 閫氳妯″潡(FlowNode node) { RunNodeAsync(node); }
 
         #endregion
 
diff --git a/LB_SmartVision/VisionForm.cs b/LB_SmartVision/VisionForm.cs
index 544f872..98bf6a7 100644
--- a/LB_SmartVision/VisionForm.cs
+++ b/LB_SmartVision/VisionForm.cs
@@ -17,6 +17,7 @@
 using LB_VisionProcesses.Cameras;
 using LB_VisionProcesses.Cameras.HRCameras;
 using LB_VisionProcesses.Communicators;
+using LB_VisionProcesses.Communicators.SiemensS7;
 using LB_VisionProcesses.Communicators.TCom;
 using LB_VisionProcesses.Forms;
 using log4net.Config;
@@ -43,7 +44,7 @@
     {
         AllProcessesPage AllProcessesPages = new AllProcessesPage();
         CamerasEditPage CamerasEditPage = new CamerasEditPage();
-        HistoricalDataEditPage HistoricalDataEditPage = new HistoricalDataEditPage();        
+        HistoricalDataEditPage HistoricalDataEditPage = new HistoricalDataEditPage();
         CommunicatorsEditPage CommunicatorsEditPage = new CommunicatorsEditPage();
         SettingEditPage SettingEditPage = new SettingEditPage();
         MESEditPage MESEditPage = new MESEditPage();
@@ -790,65 +791,122 @@
                 {
                     string CommunicatorName = CommunicatorConnectionString.Key;
                     string CommunicatorAddress = CommunicatorConnectionString.Value;
-
-                    // 瀹氫箟姝e垯琛ㄨ揪寮忎互鎻愬彇鍗忚銆両P 鍦板潃鍜岀鍙�
-                    //1.    \((.*?)\)锛歕(鍜� \) 鏄敤浜庡尮閰嶆嫭鍙风殑杞箟瀛楃銆�
-                    //      (.*?) 鏄竴涓潪璐┆鐨勫尮閰嶏紝鐢ㄦ潵鍖归厤绫诲悕锛圡yProcesses.Communicators.TCPServer 鎴� MyProcesses.Communicators.UARTPort锛夈��
-                    //2.    ([^:] +)锛氬尮閰嶅啋鍙蜂箣鍓嶇殑閮ㄥ垎锛屽嵆鍦板潃锛�127.0.0.1 鎴� COM5锛夈�傝繖閲屼娇鐢ㄤ簡[^:] 鏉ュ尮閰嶉櫎浜嗗啋鍙蜂箣澶栫殑浠绘剰瀛楃銆�
-                    //3.    (\d +) 锛氬尮閰嶇鍙e彿锛岀‘淇濆畠鍖归厤涓�涓垨澶氫釜鏁板瓧銆�
-
-                    string pattern = @"^\((?<ClassName>[^)]+)\)\[(?<IP>[^]]+)\]\[(?<PORT>[^]]+)\]$";
-                    Match match = Regex.Match(CommunicatorAddress, pattern);
-
-                    if (match.Success)
+                    if (!string.IsNullOrEmpty(CommunicatorAddress) && CommunicatorAddress.Contains("SiemensLBS7"))
                     {
-                        string ClassName = match.Groups["ClassName"].Value;   // "TCP"
-                        string IP = match.Groups["IP"].Value;          // "127.0.0.1"
-                        string PORT = match.Groups["PORT"].Value;        // "1111"
+                        // 瀹氫箟姝e垯琛ㄨ揪寮忎互鎻愬彇鍗忚銆両P 鍦板潃鍜岀鍙�
+                        //1.    \((.*?)\)锛歕(鍜� \) 鏄敤浜庡尮閰嶆嫭鍙风殑杞箟瀛楃銆�
+                        //      (.*?) 鏄竴涓潪璐┆鐨勫尮閰嶏紝鐢ㄦ潵鍖归厤绫诲悕锛圡yProcesses.Communicators.TCPServer 鎴� MyProcesses.Communicators.UARTPort锛夈��
+                        //2.    ([^:] +)锛氬尮閰嶅啋鍙蜂箣鍓嶇殑閮ㄥ垎锛屽嵆鍦板潃锛�127.0.0.1 鎴� COM5锛夈�傝繖閲屼娇鐢ㄤ簡[^:] 鏉ュ尮閰嶉櫎浜嗗啋鍙蜂箣澶栫殑浠绘剰瀛楃銆�
+                        //3.    (\d +) 锛氬尮閰嶇鍙e彿锛岀‘淇濆畠鍖归厤涓�涓垨澶氫釜鏁板瓧銆�
 
-                        if (string.IsNullOrEmpty(ClassName) || string.IsNullOrEmpty(IP) || string.IsNullOrEmpty(PORT))
-                            break;
+                        string pattern = @"^\((?<ClassName>[^)]+)\)\[(?<IP>[^]]+)\]\[(?<Slot>[^]]+)\]\[(?<CpuType>[^]]+)\]\[(?<PlcAddress>[^]]+)\]$";
+                        Match match = Regex.Match(CommunicatorAddress, pattern);
 
-                        //鍒╃敤鍙嶅皠鍒涘缓瀹炰緥
-                        Type type = IProcess.GetExecutingAssembly().GetType(ClassName);
-                        if (type == null)
+                        if (match.Success)
                         {
-                            Debug.WriteLine("Class not found.");
-                            return false;
-                        }
-                        var Communicator = Activator.CreateInstance(type, CommunicatorName) as BaseCommunicator;
+                            string ClassName = match.Groups["ClassName"].Value;   // "TCP"
+                            string IP = match.Groups["IP"].Value;          // "127.0.0.1"
+                            string Slot = match.Groups["Slot"].Value;        // "1111"
+                            string CpuType= match.Groups["CpuType"].Value;
+                            string PlcAddress = match.Groups["PlcAddress"].Value;
+                            if (string.IsNullOrEmpty(ClassName) || string.IsNullOrEmpty(IP) || string.IsNullOrEmpty(Slot) || string.IsNullOrEmpty(CpuType) || string.IsNullOrEmpty(PlcAddress))
+                                break;
 
-                        if (Communicator == null)
-                        {
-                            Debug.WriteLine("BaseCommunicator not found.");
-                            return false;
-                        }
+                            //鍒╃敤鍙嶅皠鍒涘缓瀹炰緥
+                            Type type = IProcess.GetExecutingAssembly().GetType(ClassName);
+                            if (type == null)
+                            {
+                                Debug.WriteLine("Class not found.");
+                                return false;
+                            }
+                            var Communicator = Activator.CreateInstance(type, CommunicatorName) as BaseCommunicator;
 
-                        //TCP瀹㈡埛绔渶鍚庡啀杩炴帴
-                        if (Communicator is TCPClient)
-                        {
-                            clientsCommunicatorsConnectionString.TryAdd(CommunicatorConnectionString.Key, CommunicatorConnectionString.Value);
-                            continue;
-                        }
+                            if (Communicator == null)
+                            {
+                                Debug.WriteLine("BaseCommunicator not found.");
+                                return false;
+                            }
 
-                        Communicator.CommunicatorConnections.Add("鍦板潃", IP);
-                        Communicator.CommunicatorConnections.Add("绔彛", PORT);
-                        Communicator.CommunicatorName = CommunicatorName;
-                        if (!Communicator.Connect())
-                        {
-                            LogInfo($"鍒濆鍖栭�氳鍙{CommunicatorName}]澶辫触,鍘熷洜鏄瘂Communicator.Msg}", LogInfoType.ERROR);
+                            Communicator.CommunicatorConnections.Add("鍦板潃", IP);
+                            Communicator.CommunicatorConnections.Add("绔彛", Slot);
+                            Communicator.CommunicatorConnections.Add("鍨嬪彿", CpuType);
+                            Communicator.CommunicatorConnections.Add("鍙橀噺鍦板潃", PlcAddress);
+                            Communicator.CommunicatorName = CommunicatorName;
+                            if (!Communicator.Connect())
+                            {
+                                LogInfo($"鍒濆鍖栭�氳鍙{CommunicatorName}]澶辫触,鍘熷洜鏄瘂Communicator.Msg}", LogInfoType.ERROR);
+                            }
+                            else
+                            {
+                                LogInfo($"鍒濆鍖栭�氳鍙{CommunicatorName}]鎴愬姛", LogInfoType.PASS);
+                            }
+                            GlobalVar.dicCommunicators.TryAdd(CommunicatorName, Communicator);
                         }
                         else
                         {
-                            LogInfo($"鍒濆鍖栭�氳鍙{CommunicatorName}]鎴愬姛", LogInfoType.PASS);
+                            Debug.WriteLine("No match found.");
                         }
-                        GlobalVar.dicCommunicators.TryAdd(CommunicatorName, Communicator);
                     }
                     else
                     {
-                        Debug.WriteLine("No match found.");
-                    }
+                        // 瀹氫箟姝e垯琛ㄨ揪寮忎互鎻愬彇鍗忚銆両P 鍦板潃鍜岀鍙�
+                        //1.    \((.*?)\)锛歕(鍜� \) 鏄敤浜庡尮閰嶆嫭鍙风殑杞箟瀛楃銆�
+                        //      (.*?) 鏄竴涓潪璐┆鐨勫尮閰嶏紝鐢ㄦ潵鍖归厤绫诲悕锛圡yProcesses.Communicators.TCPServer 鎴� MyProcesses.Communicators.UARTPort锛夈��
+                        //2.    ([^:] +)锛氬尮閰嶅啋鍙蜂箣鍓嶇殑閮ㄥ垎锛屽嵆鍦板潃锛�127.0.0.1 鎴� COM5锛夈�傝繖閲屼娇鐢ㄤ簡[^:] 鏉ュ尮閰嶉櫎浜嗗啋鍙蜂箣澶栫殑浠绘剰瀛楃銆�
+                        //3.    (\d +) 锛氬尮閰嶇鍙e彿锛岀‘淇濆畠鍖归厤涓�涓垨澶氫釜鏁板瓧銆�
 
+                        string pattern = @"^\((?<ClassName>[^)]+)\)\[(?<IP>[^]]+)\]\[(?<PORT>[^]]+)\]$";
+                        Match match = Regex.Match(CommunicatorAddress, pattern);
+
+                        if (match.Success)
+                        {
+                            string ClassName = match.Groups["ClassName"].Value;   // "TCP"
+                            string IP = match.Groups["IP"].Value;          // "127.0.0.1"
+                            string PORT = match.Groups["PORT"].Value;        // "1111"
+
+                            if (string.IsNullOrEmpty(ClassName) || string.IsNullOrEmpty(IP) || string.IsNullOrEmpty(PORT))
+                                break;
+
+                            //鍒╃敤鍙嶅皠鍒涘缓瀹炰緥
+                            Type type = IProcess.GetExecutingAssembly().GetType(ClassName);
+                            if (type == null)
+                            {
+                                Debug.WriteLine("Class not found.");
+                                return false;
+                            }
+                            var Communicator = Activator.CreateInstance(type, CommunicatorName) as BaseCommunicator;
+
+                            if (Communicator == null)
+                            {
+                                Debug.WriteLine("BaseCommunicator not found.");
+                                return false;
+                            }
+
+                            //TCP瀹㈡埛绔渶鍚庡啀杩炴帴
+                            if (Communicator is TCPClient)
+                            {
+                                clientsCommunicatorsConnectionString.TryAdd(CommunicatorConnectionString.Key, CommunicatorConnectionString.Value);
+                                continue;
+                            }
+
+                            Communicator.CommunicatorConnections.Add("鍦板潃", IP);
+                            Communicator.CommunicatorConnections.Add("绔彛", PORT);
+                            Communicator.CommunicatorName = CommunicatorName;
+                            if (!Communicator.Connect())
+                            {
+                                LogInfo($"鍒濆鍖栭�氳鍙{CommunicatorName}]澶辫触,鍘熷洜鏄瘂Communicator.Msg}", LogInfoType.ERROR);
+                            }
+                            else
+                            {
+                                LogInfo($"鍒濆鍖栭�氳鍙{CommunicatorName}]鎴愬姛", LogInfoType.PASS);
+                            }
+                            GlobalVar.dicCommunicators.TryAdd(CommunicatorName, Communicator);
+                        }
+                        else
+                        {
+                            Debug.WriteLine("No match found.");
+                        }
+                    }
                 }
 
                 //TCP瀹㈡埛绔渶鍚庤繛鎺�
@@ -929,13 +987,26 @@
                     string ClassName = item.Value.GetType().FullName;// "TCP"
                     string IP = item.Value.CommunicatorConnections["鍦板潃"].ToString();//"127.0.0.1"
                     string PORT = item.Value.CommunicatorConnections["绔彛"].ToString();//"1111"
-
-                    if (string.IsNullOrEmpty(ClassName) || string.IsNullOrEmpty(IP) || string.IsNullOrEmpty(PORT))
+                    if (!string.IsNullOrEmpty(ClassName) && ClassName.Contains("SiemensLBS7"))
                     {
-                        break;
+                        string CpuType = item.Value.CommunicatorConnections["鍨嬪彿"].ToString();
+                        string PlcAddress = item.Value.CommunicatorConnections["鍙橀噺鍦板潃"].ToString();
+                        if (string.IsNullOrEmpty(ClassName) || string.IsNullOrEmpty(IP) || string.IsNullOrEmpty(PORT) || string.IsNullOrEmpty(CpuType) || string.IsNullOrEmpty(PlcAddress))
+                        {
+                            break;
+                        }
+                        string CommunicatorConnectionString = $"({ClassName})[{IP}][{PORT}][{CpuType}][{PlcAddress}]";
+                        GlobalVar.allCommunicatorsConnectionString.TryAdd(item.Key, CommunicatorConnectionString);
                     }
-                    string CommunicatorConnectionString = $"({ClassName})[{IP}][{PORT}]";
-                    GlobalVar.allCommunicatorsConnectionString.TryAdd(item.Key, CommunicatorConnectionString);
+                    else
+                    {
+                        if (string.IsNullOrEmpty(ClassName) || string.IsNullOrEmpty(IP) || string.IsNullOrEmpty(PORT))
+                        {
+                            break;
+                        }
+                        string CommunicatorConnectionString = $"({ClassName})[{IP}][{PORT}]";
+                        GlobalVar.allCommunicatorsConnectionString.TryAdd(item.Key, CommunicatorConnectionString);
+                    }
                 }
                 var settings = new JsonSerializerSettings
                 {
diff --git a/LB_VisionFlowNode/IFlowContext.cs b/LB_VisionFlowNode/IFlowContext.cs
index 8afc0ca..6b43b6c 100644
--- a/LB_VisionFlowNode/IFlowContext.cs
+++ b/LB_VisionFlowNode/IFlowContext.cs
@@ -283,6 +283,9 @@
         [Node("Halcon2D鏂戠偣宸ュ叿", "Haclon2D宸ュ叿", "Basic", "Halcon2D鏂戠偣宸ュ叿")]
         public void Halcon2D鏂戠偣宸ュ叿(FlowNode node) { RunNodeAsync(node); }
 
+        [Node("閫氳妯″潡", "閫氳妯″潡宸ュ叿", "Basic", "閫氳妯″潡")]
+        public void 閫氳妯″潡(FlowNode node) { RunNodeAsync(node); }
+
 
         #endregion
 
diff --git a/LB_VisionProcesses/Communicators/CommunicatorConfig.cs b/LB_VisionProcesses/Communicators/CommunicatorConfig.cs
index bb0f4bd..56ea328 100644
--- a/LB_VisionProcesses/Communicators/CommunicatorConfig.cs
+++ b/LB_VisionProcesses/Communicators/CommunicatorConfig.cs
@@ -7,7 +7,7 @@
 namespace LB_VisionProcesses.Communicators
 {
     [Serializable]
-    [Process("閫氳娴嬭瘯", Category = "閫氳宸ュ叿", Description = "鍒涘缓閫氳娴嬭瘯宸ュ叿")]
+    [Process("閫氳妯″潡", Category = "閫氳宸ュ叿", Description = "鍒涘缓閫氳妯″潡宸ュ叿")]
     public class CommunicatorConfig : IProcess
     {
         /// <summary>
@@ -19,7 +19,7 @@
         {
             this.dicCommunicators = dicCommunicators;
 
-            strProcessName = "閫氳娴嬭瘯";
+            strProcessName = "閫氳妯″潡";
             strProcessClass = "LB_VisionProcesses.Communicators.CommunicatorConfig";
 
             Params.Inputs.Add("閫氳鍙e悕", "");
diff --git a/LB_VisionProcesses/Communicators/CommunicatorForm.Designer.cs b/LB_VisionProcesses/Communicators/CommunicatorForm.Designer.cs
index 74ab279..d9998c9 100644
--- a/LB_VisionProcesses/Communicators/CommunicatorForm.Designer.cs
+++ b/LB_VisionProcesses/Communicators/CommunicatorForm.Designer.cs
@@ -54,6 +54,8 @@
             label6 = new Label();
             themeForm1 = new ReaLTaiizor.Forms.ThemeForm();
             controlBox1 = new ReaLTaiizor.Controls.ControlBox();
+            lblAddress = new Label();
+            txtAddress = new TextBox();
             grpSetting.SuspendLayout();
             grpReceive.SuspendLayout();
             grpTest.SuspendLayout();
@@ -102,7 +104,7 @@
             // 
             // btnDisconnect
             // 
-            btnDisconnect.ForeColor = SystemColors.WindowText;
+            btnDisconnect.ForeColor = SystemColors.Control;
             btnDisconnect.Location = new Point(118, 109);
             btnDisconnect.Name = "btnDisconnect";
             btnDisconnect.Size = new Size(75, 23);
@@ -113,7 +115,7 @@
             // 
             // btnConnect
             // 
-            btnConnect.ForeColor = SystemColors.WindowText;
+            btnConnect.ForeColor = SystemColors.Control;
             btnConnect.Location = new Point(14, 109);
             btnConnect.Name = "btnConnect";
             btnConnect.Size = new Size(75, 23);
@@ -185,11 +187,13 @@
             // grpTest
             // 
             grpTest.Controls.Add(lblCom);
+            grpTest.Controls.Add(txtAddress);
             grpTest.Controls.Add(ckbRuleCheck);
             grpTest.Controls.Add(cmbCom);
             grpTest.Controls.Add(cmbType);
             grpTest.Controls.Add(lblType);
             grpTest.Controls.Add(btnRun);
+            grpTest.Controls.Add(lblAddress);
             grpTest.Controls.Add(lblMsg);
             grpTest.Controls.Add(txtMsg);
             grpTest.ForeColor = SystemColors.Control;
@@ -269,6 +273,7 @@
             // 
             txtMsg.Location = new Point(59, 76);
             txtMsg.Name = "txtMsg";
+            txtMsg.ReadOnly = true;
             txtMsg.Size = new Size(245, 23);
             txtMsg.TabIndex = 0;
             // 
@@ -329,6 +334,23 @@
             controlBox1.TabIndex = 0;
             controlBox1.Text = "controlBox1";
             // 
+            // lblAddress
+            // 
+            lblAddress.AutoSize = true;
+            lblAddress.Location = new Point(20, 115);
+            lblAddress.Name = "lblAddress";
+            lblAddress.Size = new Size(32, 17);
+            lblAddress.TabIndex = 0;
+            lblAddress.Text = "鍦板潃";
+            // 
+            // txtAddress
+            // 
+            txtAddress.Location = new Point(59, 112);
+            txtAddress.Name = "txtAddress";
+            txtAddress.ReadOnly = true;
+            txtAddress.Size = new Size(94, 23);
+            txtAddress.TabIndex = 6;
+            // 
             // CommunicatorForm
             // 
             AutoScaleDimensions = new SizeF(96F, 96F);
@@ -388,5 +410,7 @@
         private Label label6;
         private ReaLTaiizor.Forms.ThemeForm themeForm1;
         private ReaLTaiizor.Controls.ControlBox controlBox1;
+        private TextBox txtAddress;
+        private Label lblAddress;
     }
 }
\ No newline at end of file
diff --git a/LB_VisionProcesses/Communicators/CommunicatorForm.cs b/LB_VisionProcesses/Communicators/CommunicatorForm.cs
index c5298b1..0de5c45 100644
--- a/LB_VisionProcesses/Communicators/CommunicatorForm.cs
+++ b/LB_VisionProcesses/Communicators/CommunicatorForm.cs
@@ -85,6 +85,7 @@
                 cmbType.Text = type.ToString();
                 ckbRuleCheck.Checked = bRuleCheck;
                 txtMsg.Text = Msg;
+                this.grpSetting.ForeColor= SystemColors.Control;
             }
         }
 
@@ -115,12 +116,16 @@
 
                 cmbIP.Visible = true;
                 txtIP.Visible = false;
+                this.lblAddress.Visible = false;
+                this.txtAddress.Visible = false;
+
 
                 lblIP.Text = "涓插彛鍙�";
                 lblIP.Text = "娉㈢壒鐜�";
 
                 cmbIP.Text = communicator.CommunicatorConnections["鍦板潃"].ToString();
                 txtPort.Text = communicator.CommunicatorConnections["绔彛"].ToString();
+                this.grpSetting.ForeColor = SystemColors.Control;
             }
             else if (communicator is LocalMonitor)
             {
@@ -129,31 +134,40 @@
 
                 cmbIP.Visible = false;
                 txtIP.Visible = true;
+                this.lblAddress.Visible = false;
+                this.txtAddress.Visible = false;
+
 
                 lblIP.Text = "鐩戞帶鏂囦欢";
                 lblIP.Text = "鍐欏叆鏂囦欢";
 
                 txtIP.Text = communicator.CommunicatorConnections["鍦板潃"].ToString();
                 txtPort.Text = communicator.CommunicatorConnections["绔彛"].ToString();
+                this.grpSetting.ForeColor = SystemColors.Control;
             }
             else if (communicator is SiemensLBS7)
             {
                 btnSend.Enabled = communicator.bConnected;
-                btnRuleSend.Enabled = communicator.bConnected;
 
                 cmbIP.Visible = false;
                 txtIP.Visible = true;
-
+                this.lblAddress.Visible = true;
+                this.txtAddress.Visible = true;
                 lblIP.Text = "IP";
                 lblIP.Text = "妲�";
 
                 txtIP.Text = communicator.CommunicatorConnections["鍦板潃"].ToString();
-                txtPort.Text = communicator.CommunicatorConnections["妲�"].ToString();
+                txtPort.Text = communicator.CommunicatorConnections["绔彛"].ToString();
+                this.txtAddress.Text = communicator.CommunicatorConnections["鍙橀噺鍦板潃"]?.ToString();
+                this.grpSetting.ForeColor = SystemColors.Control;
+                btnRuleSend.Visible = false;
             }
             else
             {
                 btnSend.Enabled = communicator.bConnected;
                 btnRuleSend.Enabled = false;
+                this.lblAddress.Visible = false;
+                this.txtAddress.Visible = false;
 
                 cmbIP.Visible = false;
                 txtIP.Visible = true;
diff --git a/LB_VisionProcesses/Communicators/CommunicatorForm.resx b/LB_VisionProcesses/Communicators/CommunicatorForm.resx
index 9ca1331..83adc1a 100644
--- a/LB_VisionProcesses/Communicators/CommunicatorForm.resx
+++ b/LB_VisionProcesses/Communicators/CommunicatorForm.resx
@@ -121,7 +121,7 @@
   <data name="themeForm1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
-        wgAADsIBFShKgAAAA+JJREFUWEftVkuIHGUQbt34iMEoq2S2q3p3yTJsuqpnJ+L6WBRdwaigohfFgEou
+        wQAADsEBuJFr7QAAA+JJREFUWEftVkuIHGUQbt34iMEoq2S2q3p3yTJsuqpnJ+L6WBRdwaigohfFgEou
         BkVBUPCBCEG8BXNQ48GLeImCehIJxMsqhsSZruod46K4HtSIGjU+4iOr0c1I9fSsM3/PLNtCPO0H36m/
         evz/X11VnreKVRTAHPOZumkY6lFwqURws3BwZ8ywTQnuiCP/+iTCzY1qaUPzdm/Atf3PaHre6XPsjyQM
         2xLGV4XwIyX4QRj+UMK/lPFvJTyhBMeV8IgQvmRJuH4Ko+l5p9UjGBbCJ5RxTgj+VMZmXxKcSAjekHE/

--
Gitblit v1.9.3