From 510dc693e91b291f36667088f47923591d25c98f Mon Sep 17 00:00:00 2001
From: C3204 <zhengyabo@lanpucloud.cn>
Date: 星期五, 16 一月 2026 16:43:25 +0800
Subject: [PATCH] 添加用户以及历史数据底层逻辑修复ProcessRunBll。

---
 LB_SmartVision/Forms/Pages/CommunicatorPage/CommunicatorForm.cs |   47 ++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 46 insertions(+), 1 deletions(-)

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);
+            }
+        }
     }
 }

--
Gitblit v1.9.3