From c48b29f9997cd8985ab898c1979b8194e4119c76 Mon Sep 17 00:00:00 2001
From: C3032 <C3032@BC3032>
Date: 星期二, 13 一月 2026 08:49:16 +0800
Subject: [PATCH] 在UserManagementEditPage.cs界面为修改按钮添加了指令,实现用户信息的修改 在HistoricalDataEditPage.cs界面为导出按钮添加了指令,还未完成
---
LB_SmartVision/Forms/Pages/CommunicatorPage/CreateCommunicatorForm.cs | 140 ++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 128 insertions(+), 12 deletions(-)
diff --git a/LB_SmartVision/Forms/Pages/CommunicatorPage/CreateCommunicatorForm.cs b/LB_SmartVision/Forms/Pages/CommunicatorPage/CreateCommunicatorForm.cs
index 0865a23..2fbd393 100644
--- a/LB_SmartVision/Forms/Pages/CommunicatorPage/CreateCommunicatorForm.cs
+++ b/LB_SmartVision/Forms/Pages/CommunicatorPage/CreateCommunicatorForm.cs
@@ -1,4 +1,6 @@
-锘縰sing LB_VisionProcesses.Communicators;
+锘縰sing LB_SmartVisionCommon;
+using LB_VisionProcesses.Communicators;
+using LB_VisionProcesses.Communicators.SiemensS7;
using LB_VisionProcesses.Communicators.TCom;
using RJCP.IO.Ports;
using System;
@@ -30,17 +32,18 @@
communicator = new UARTPort();
rButtonUART.Checked = true;
+ uiLabelS7Type.Visible = false;
+ uiComboBoxS7Type.Visible = false;
uiButtonCreate.Enabled = false;
}
private void uiButtonTest_Click(object sender, EventArgs e)
{
uiButtonCreate.Enabled = false;
-
rButtonUART.Enabled = false;
rButtonTCPServer.Enabled = false;
rButtonTCPClient.Enabled = false;
- rButtonMonitor.Enabled = false;
+ rButtonS7.Enabled = false;
if (communicator != null)
communicator.Disconnect();
@@ -51,6 +54,8 @@
IP = uiComboBoxPort.Text;
PORT = uiTextBoxPort.Text;
+ communicator.CommunicatorConnections.Add("鍦板潃", IP);
+ communicator.CommunicatorConnections.Add("绔彛", PORT);
}
else if (rButtonTCPServer.Checked)
{
@@ -58,6 +63,8 @@
IP = uiIPTextBox.Text;
PORT = uiTextBoxPort.Text;
+ communicator.CommunicatorConnections.Add("鍦板潃", IP);
+ communicator.CommunicatorConnections.Add("绔彛", PORT);
}
else if (rButtonTCPClient.Checked)
{
@@ -65,22 +72,65 @@
IP = uiIPTextBox.Text;
PORT = uiTextBoxPort.Text;
+ communicator.CommunicatorConnections.Add("鍦板潃", IP);
+ communicator.CommunicatorConnections.Add("绔彛", PORT);
}
- else if (rButtonMonitor.Checked)
+ else if (rButtonS7.Checked)
{
- communicator = new LocalMonitor();
+ communicator = new SiemensLBS7();
IP = uiTextBoxPath.Text;
PORT = uiTextBoxPort.Text;
+ switch (uiComboBoxS7Type.Text)
+ {
+ case "S7200":
+ {
+ cpuType = S7.Net.CpuType.S7200;
+ break;
+ }
+ case "Logo0BA8":
+ {
+ cpuType = S7.Net.CpuType.Logo0BA8;
+ break;
+ }
+ case "S7200Smart":
+ {
+ cpuType = S7.Net.CpuType.S7200Smart;
+ break;
+ }
+ case "S7300":
+ {
+ cpuType = S7.Net.CpuType.S7300;
+ break;
+ }
+ case "S7400":
+ {
+ cpuType = S7.Net.CpuType.S7400;
+ break;
+ }
+ case "S71200":
+ {
+ cpuType = S7.Net.CpuType.S71200;
+ break;
+ }
+ case "S71500":
+ {
+ cpuType = S7.Net.CpuType.S71500;
+ break;
+ }
+ default:
+ cpuType = S7.Net.CpuType.S71500;
+ break;
+ }
+ communicator.CommunicatorConnections.Add("鍦板潃", IP);
+ communicator.CommunicatorConnections.Add("绔彛", PORT);
+ communicator.CommunicatorConnections.Add("鍨嬪彿", cpuType);
}
else
{
MessageBox.Show("鏈�夋嫨閫氳绫诲瀷!", "寮傚父");
return;
}
-
- communicator.CommunicatorConnections.Add("鍦板潃", IP);
- communicator.CommunicatorConnections.Add("绔彛", PORT);
if (communicator.Connect())
{
uiButtonCreate.Enabled = true;
@@ -92,6 +142,7 @@
public string IP = string.Empty;
public string PORT = string.Empty;
+ public S7.Net.CpuType cpuType = S7.Net.CpuType.S71500;
private void uiButtonCreate_Click(object sender, EventArgs e)
{
@@ -131,6 +182,10 @@
uiLabelPort.Text = "娉㈢壒鐜�";
uiTextBoxPort.Visible = true;
+ uiLabelS7Type.Visible = false;
+ uiComboBoxS7Type.Visible = false;
+
+
uiButtonCreate.Enabled = false;
}
}
@@ -153,6 +208,9 @@
uiLabelPort.Text = "绔彛";
uiTextBoxPort.Visible = true;
+ uiLabelS7Type.Visible = false;
+ uiComboBoxS7Type.Visible = false;
+
uiButtonCreate.Enabled = false;
}
}
@@ -174,26 +232,39 @@
uiLabelPort.Visible = true;
uiLabelPort.Text = "绔彛";
uiTextBoxPort.Visible = true;
+
+ uiLabelS7Type.Visible = false;
+ uiComboBoxS7Type.Visible = false;
+
}
}
- private void rButtonMonitor_CheckedChanged(object sender, EventArgs e)
+ private void rButtonS7_CheckedChanged(object sender, EventArgs e)
{
uiButtonCreate.Enabled = false;
if (communicator != null)
communicator.Disconnect();
- if (rButtonMonitor.Checked)
+ if (rButtonS7.Checked)
{
uiLabelIP.Visible = true;
- uiLabelIP.Text = "鐩戞帶鏂囦欢";
+ uiLabelIP.Text = "鍦板潃";
uiIPTextBox.Visible = false;
uiComboBoxPort.Visible = false;
uiTextBoxPath.Visible = true;
uiLabelPort.Visible = true;
- uiLabelPort.Text = "鍐欏叆鏂囦欢";
+ uiLabelPort.Text = "妲�";
uiTextBoxPort.Visible = true;
+
+ uiLabelS7Type.Visible = true;
+ uiComboBoxS7Type.Visible = true;
+ uiComboBoxS7Type.Items.Clear();
+
+ foreach (var c in Enum.GetValues(typeof(S7.Net.CpuType)))
+ {
+ uiComboBoxS7Type.Items.Add(c.ToString());
+ }
}
}
@@ -219,5 +290,50 @@
{
uiButtonCreate.Enabled = false;
}
+
+ private void uiComboBoxS7Type_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ switch (uiComboBoxS7Type.Text)
+ {
+ case "S7200":
+ {
+ cpuType = S7.Net.CpuType.S7200;
+ break;
+ }
+ case "Logo0BA8":
+ {
+ cpuType = S7.Net.CpuType.Logo0BA8;
+ break;
+ }
+ case "S7200Smart":
+ {
+ cpuType = S7.Net.CpuType.S7200Smart;
+ break;
+ }
+ case "S7300":
+ {
+ cpuType = S7.Net.CpuType.S7300;
+ break;
+ }
+ case "S7400":
+ {
+ cpuType = S7.Net.CpuType.S7400;
+ break;
+ }
+ case "S71200":
+ {
+ cpuType = S7.Net.CpuType.S71200;
+ break;
+ }
+ case "S71500":
+ {
+ cpuType = S7.Net.CpuType.S71500;
+ break;
+ }
+ default:
+ cpuType = S7.Net.CpuType.S71500;
+ break;
+ }
+ }
}
}
--
Gitblit v1.9.3