C3204
2025-12-31 efac9037f25e301ca5564354547776737e8562e7
Merge branch 'master' of http://lanpucloud.cn:1111/r/~zhengyabo/LB_TyreAppearanceInspectionSoftware
已修改6个文件
302 ■■■■■ 文件已修改
LB_SmartVision/Forms/Pages/CameraPage/CamerasEditPage.Designer.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
LB_SmartVision/Forms/Pages/CameraPage/CamerasEditPage.cs 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LB_SmartVision/Forms/Pages/CameraPage/CreateCameraForm.Designer.cs 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LB_SmartVision/Forms/Pages/UserManagementPage/UserManagementEditPage.Designer.cs 134 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LB_SmartVision/Forms/Pages/UserManagementPage/UserManagementEditPage.cs 143 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LB_SmartVision/VisionForm.Designer.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LB_SmartVision/Forms/Pages/CameraPage/CamerasEditPage.Designer.cs
@@ -100,8 +100,8 @@
            tableLayoutPanel1.ColumnCount = 1;
            tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F));
            tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 20F));
            tableLayoutPanel1.Controls.Add(tableLayoutPanel2, 0, 1);
            tableLayoutPanel1.Controls.Add(uiFlowLayoutPanel1, 0, 0);
            tableLayoutPanel1.Controls.Add(tableLayoutPanel2, 0, 1);
            tableLayoutPanel1.Dock = DockStyle.Fill;
            tableLayoutPanel1.Location = new Point(0, 0);
            tableLayoutPanel1.Name = "tableLayoutPanel1";
LB_SmartVision/Forms/Pages/CameraPage/CamerasEditPage.cs
@@ -137,11 +137,16 @@
                if (name != Name)
                    continue;
                if (GlobalVar.dicCameras.ContainsKey(name))
                RemoveFlowEvent(flow);
                uiFlowLayoutPanel1.Controls.Remove(uiFlowLayoutPanel1.Controls[i]);
                if (GlobalVar.dicCameras.TryRemove(name, out BaseCamera BaseCamera))
                {
                    MotionControlPage.MotionControlForm cameraForm = new MotionControlPage.MotionControlForm(GlobalVar.dicCameras[name]);
                    cameraForm.Show();
                    BaseCamera.Dispose();
                    LogInfo?.Invoke(string.Format("移除相机[{0}]", name), LogInfoType.INFO);
                }
                else
                    LogInfo?.Invoke(string.Format("移除相机[{0}]失败", name), LogInfoType.ERROR);
            }
        }
LB_SmartVision/Forms/Pages/CameraPage/CreateCameraForm.Designer.cs
@@ -105,7 +105,7 @@
            uiComboBoxBrand.Margin = new Padding(4, 5, 4, 5);
            uiComboBoxBrand.MinimumSize = new Size(63, 0);
            uiComboBoxBrand.Name = "uiComboBoxBrand";
            uiComboBoxBrand.Size = new Size(150, 28);
            uiComboBoxBrand.Size = new Size(150, 24);
            uiComboBoxBrand.TabIndex = 11;
            uiComboBoxBrand.SelectedIndexChanged += uiComboBoxBrand_SelectedIndexChanged;
            uiComboBoxBrand.MouseClick += uiComboBoxBrand_MouseClick;
@@ -117,7 +117,7 @@
            uiComboBoxSN.Margin = new Padding(4, 5, 4, 5);
            uiComboBoxSN.MinimumSize = new Size(63, 0);
            uiComboBoxSN.Name = "uiComboBoxSN";
            uiComboBoxSN.Size = new Size(150, 28);
            uiComboBoxSN.Size = new Size(150, 24);
            uiComboBoxSN.TabIndex = 12;
            uiComboBoxSN.MouseClick += uiComboBoxSN_MouseClick;
            // 
@@ -171,8 +171,9 @@
            Controls.Add(uiLabel2);
            Controls.Add(uiLabel1);
            Controls.Add(themeForm1);
            ForeColor = SystemColors.ControlText;
            FormBorderStyle = FormBorderStyle.None;
            MaximizeBox = false;
            MinimizeBox = false;
            MinimumSize = new Size(261, 61);
            Name = "CreateCameraForm";
            Text = "创建相机";
LB_SmartVision/Forms/Pages/UserManagementPage/UserManagementEditPage.Designer.cs
@@ -1,22 +1,19 @@

using ReaLTaiizor.Controls;
using Sunny.UI;
using System.Drawing.Printing;
using System.Windows.Forms;
namespace LB_SmartVision.Forms.Pages.UserManagementPage
{
    partial class UserManagementEditPage
    {
        /// <summary>
        /// 必需的设计器变量。
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;
        /// <summary>
        /// 清理所有正在使用的资源。
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
@@ -26,15 +23,17 @@
            base.Dispose(disposing);
        }
        #region 组件设计器生成的代码
        #region Windows Form Designer generated code
        /// <summary>
        /// 设计器支持所需的方法 - 不要修改
        /// 使用代码编辑器修改此方法的内容。
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            grpSetting = new ParrotGroupBox();
            btn_Add = new HopeButton();
            btn_Clear = new LostButton();
            uiFlowLayoutPanel1 = new FlowLayoutPanel();
            tableLayoutPanel1 = new TableLayoutPanel();
            tableLayoutPanel2 = new TableLayoutPanel();
            tableLayoutPanel3 = new TableLayoutPanel();
@@ -57,33 +56,68 @@
            grpSetting.SuspendLayout();
            tableLayoutPanel1.SuspendLayout();
            tableLayoutPanel2.SuspendLayout();
            tableLayoutPanel3.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)dataGridViewUM).BeginInit();
            tableLayoutPanel4.SuspendLayout();
            SuspendLayout();
            // 
            // grpSetting
            // btn_Add
            // 
            grpSetting.BorderColor = Color.DodgerBlue;
            grpSetting.BorderWidth = 1;
            grpSetting.Controls.Add(tableLayoutPanel1);
            grpSetting.Dock = DockStyle.Fill;
            grpSetting.Font = new Font("宋体", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
            grpSetting.Location = new Point(0, 0);
            grpSetting.Name = "grpSetting";
            grpSetting.ShowText = true;
            grpSetting.Size = new Size(866, 580);
            grpSetting.TabIndex = 6;
            grpSetting.TabStop = false;
            grpSetting.Text = "用户管理设置";
            grpSetting.TextColor = Color.DodgerBlue;
            btn_Add.BorderColor = Color.FromArgb(220, 223, 230);
            btn_Add.ButtonType = ReaLTaiizor.Util.HopeButtonType.Primary;
            btn_Add.Cursor = Cursors.Hand;
            btn_Add.DangerColor = Color.FromArgb(245, 108, 108);
            btn_Add.DefaultColor = Color.FromArgb(255, 255, 255);
            btn_Add.Dock = DockStyle.Fill;
            btn_Add.Font = new Font("宋体", 12F);
            btn_Add.HoverTextColor = Color.FromArgb(48, 49, 51);
            btn_Add.InfoColor = Color.FromArgb(144, 147, 153);
            btn_Add.Location = new Point(503, 3);
            btn_Add.MinimumSize = new Size(1, 1);
            btn_Add.Name = "btn_Add";
            btn_Add.PrimaryColor = Color.FromArgb(64, 158, 255);
            btn_Add.Size = new Size(95, 38);
            btn_Add.SuccessColor = Color.FromArgb(103, 194, 58);
            btn_Add.TabIndex = 11;
            btn_Add.Text = "增加";
            btn_Add.TextColor = Color.White;
            btn_Add.WarningColor = Color.FromArgb(230, 162, 60);
            //
            // btn_Clear
            //
            btn_Clear.BackColor = Color.FromArgb(45, 45, 48);
            btn_Clear.Cursor = Cursors.Hand;
            btn_Clear.Dock = DockStyle.Fill;
            btn_Clear.Font = new Font("宋体", 12F);
            btn_Clear.ForeColor = Color.White;
            btn_Clear.HoverColor = Color.DodgerBlue;
            btn_Clear.Image = null;
            btn_Clear.Location = new Point(403, 3);
            btn_Clear.MinimumSize = new Size(1, 1);
            btn_Clear.Name = "btn_Clear";
            btn_Clear.Size = new Size(94, 38);
            btn_Clear.TabIndex = 12;
            btn_Clear.Text = "清除";
            //
            // uiFlowLayoutPanel1
            //
            uiFlowLayoutPanel1.BackColor = Color.FromArgb(32, 41, 50);
            uiFlowLayoutPanel1.Dock = DockStyle.Fill;
            uiFlowLayoutPanel1.Font = new Font("宋体", 12F);
            uiFlowLayoutPanel1.ForeColor = SystemColors.Control;
            uiFlowLayoutPanel1.Location = new Point(4, 5);
            uiFlowLayoutPanel1.Margin = new Padding(4, 5, 4, 5);
            uiFlowLayoutPanel1.MinimumSize = new Size(1, 1);
            uiFlowLayoutPanel1.Name = "uiFlowLayoutPanel1";
            uiFlowLayoutPanel1.Padding = new Padding(2);
            uiFlowLayoutPanel1.Size = new Size(599, 293);
            uiFlowLayoutPanel1.TabIndex = 10;
            uiFlowLayoutPanel1.Text = "`";
            // 
            // tableLayoutPanel1
            // 
            tableLayoutPanel1.ColumnCount = 1;
            tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F));
            tableLayoutPanel1.Controls.Add(tableLayoutPanel2, 0, 0);
            tableLayoutPanel1.Controls.Add(tableLayoutPanel4, 0, 1);
            tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 20F));
            tableLayoutPanel1.Controls.Add(uiFlowLayoutPanel1, 0, 0);
            tableLayoutPanel1.Controls.Add(tableLayoutPanel2, 0, 1);
            tableLayoutPanel1.Dock = DockStyle.Fill;
            tableLayoutPanel1.Location = new Point(3, 22);
            tableLayoutPanel1.Name = "tableLayoutPanel1";
@@ -101,7 +135,7 @@
            tableLayoutPanel2.Controls.Add(tableLayoutPanel3, 0, 0);
            tableLayoutPanel2.Controls.Add(dataGridViewUM, 1, 0);
            tableLayoutPanel2.Dock = DockStyle.Fill;
            tableLayoutPanel2.Location = new Point(3, 3);
            tableLayoutPanel2.Location = new Point(3, 306);
            tableLayoutPanel2.Name = "tableLayoutPanel2";
            tableLayoutPanel2.RowCount = 1;
            tableLayoutPanel2.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
@@ -340,42 +374,22 @@
            // UserManagementEditPage
            // 
            BackColor = Color.FromArgb(32, 41, 50);
            Controls.Add(grpSetting);
            Controls.Add(tableLayoutPanel1);
            ForeColor = SystemColors.Control;
            Name = "UserManagementEditPage";
            Size = new Size(866, 580);
            grpSetting.ResumeLayout(false);
            grpSetting.PerformLayout();
            Size = new Size(607, 353);
            Paint += MESEditPage_Paint;
            tableLayoutPanel1.ResumeLayout(false);
            tableLayoutPanel2.ResumeLayout(false);
            tableLayoutPanel3.ResumeLayout(false);
            tableLayoutPanel3.PerformLayout();
            ((System.ComponentModel.ISupportInitialize)dataGridViewUM).EndInit();
            tableLayoutPanel4.ResumeLayout(false);
            ResumeLayout(false);
        }
        #endregion
        private ParrotGroupBox grpSetting;
        private ReaLTaiizor.Controls.HopeButton btn_Add;
        private ReaLTaiizor.Controls.LostButton btn_Clear;
        private FlowLayoutPanel uiFlowLayoutPanel1;
        private TableLayoutPanel tableLayoutPanel1;
        private TableLayoutPanel tableLayoutPanel2;
        private TableLayoutPanel tableLayoutPanel3;
        private Label labelUsername;
        private TextBox textBoxUsername;
        private TextBox textBoxEmployeeID;
        private Label labelEmployeeID;
        private TextBox textBoxName;
        private Label labelName;
        private Label labelPermission;
        private TextBox textBoxPassword;
        private Label labelPassword;
        private ComboBox comboBoxPermission;
        private DataGridView dataGridViewUM;
        private TableLayoutPanel tableLayoutPanel4;
        private HopeButton btnDel;
        private HopeButton btnEdit;
        private HopeButton btnFind;
        private ForeverButton btnAdd;
    }
}
LB_SmartVision/Forms/Pages/UserManagementPage/UserManagementEditPage.cs
@@ -1,153 +1,28 @@
using LB_SmartVision.Forms.Pages.ProcessPage;
using LB_SmartVision.ProcessRun;
using LB_VisionControl;
using LB_VisionProcesses;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using LB_VisionControl;
using OpenCvSharp.Flann;
using System;
using System.Collections.Concurrent;
using System.Data;
using System.Text;
using VisionControl.Forms;
using LB_SmartVision.Forms.Pages.SettingPage;
using LB_SmartVisionCommon;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel;
using LB_SmartVision.Forms.Pages.CameraPage;
using System.Security.Principal;
using System.Windows.Forms;
using System.Xml.Linq;
namespace LB_SmartVision.Forms.Pages.UserManagementPage
{
    public partial class UserManagementEditPage : UserControl
    {
        public Action<string, LogInfoType> LogInfo;
        RunSettingPage RunSettingPage = new RunSettingPage();
        LayoutPage LayoutPage = new LayoutPage();
        CsvPage CsvPage = new CsvPage();
        public UserManagementEditPage()
        {
            Name = "UserManagementEditPage"; 
            Text = "用户管理设置";
            InitializeComponent();
            InitializeDataGridView();
            InitializeComboBox();
        }
        private void InitializeDataGridView()
        private void MESEditPage_Paint(object sender, PaintEventArgs e)
        {
            // 设置DataGridView列宽
            dataGridViewUM.ColumnCount = 5;
            int totalWidth = dataGridViewUM.ClientSize.Width;
            int columnCount = dataGridViewUM.ColumnCount;
            int columnWidth = totalWidth / columnCount;
            // 设置最小宽度
            int minWidth = 100; // 最小宽度
            if (columnWidth < minWidth)
            {
                columnWidth = minWidth;
            }
            for (int i = 0; i < columnCount; i++)
            {
                dataGridViewUM.Columns[i].Width = columnWidth;
            }
            // 设置列标题
            dataGridViewUM.Columns[0].Name = "用户名";
            dataGridViewUM.Columns[1].Name = "密码";
            dataGridViewUM.Columns[2].Name = "姓名";
            dataGridViewUM.Columns[3].Name = "工号";
            dataGridViewUM.Columns[4].Name = "权限";
            dataGridViewUM.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
            // 禁止编辑单元格(可选)
            dataGridViewUM.ReadOnly = true;
            // 允许多行选择(可选)
            dataGridViewUM.MultiSelect = false;
            // 显示行标题(可选)
            dataGridViewUM.RowHeadersVisible = true;
            uiFlowLayoutPanel1.Controls.Clear();
        }
        private void InitializeComboBox()
        {
            // 添加权限选项
            comboBoxPermission.Items.Add("管理员");
            comboBoxPermission.Items.Add("操作员");
            // 设置默认选择项
            comboBoxPermission.SelectedIndex = 1;
        }
        private void ClearInputFields()
        {
            textBoxUsername.Clear();
            textBoxPassword.Clear();
            textBoxName.Clear();
            textBoxEmployeeID.Clear();
            comboBoxPermission.SelectedIndex = 1;
            textBoxUsername.Focus(); // 将焦点设置回用户名输入框
        }
        private void btnAdd_Click(object sender, EventArgs e)
        {
            // 验证输入
            if (string.IsNullOrWhiteSpace(textBoxUsername.Text) ||
                string.IsNullOrWhiteSpace(textBoxPassword.Text) ||
                string.IsNullOrWhiteSpace(textBoxName.Text) ||
                string.IsNullOrWhiteSpace(textBoxEmployeeID.Text))
            {
                MessageBox.Show("请填写所有必填字段!", "提示",
                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            // 创建新行数据
            string[] row = new string[]
            {
                textBoxUsername.Text,
                textBoxPassword.Text, // 实际应用中密码应该加密
                textBoxName.Text,
                textBoxEmployeeID.Text,
                comboBoxPermission.SelectedItem.ToString()
            };
            // 设置整个DataGridView的默认字体和颜色
            dataGridViewUM.DefaultCellStyle.Font = new Font("宋体", 12);
            dataGridViewUM.DefaultCellStyle.ForeColor = Color.Black;  // 字体颜色
            dataGridViewUM.DefaultCellStyle.BackColor = Color.White;   // 背景颜色
            // 添加新行到DataGridView
            dataGridViewUM.Rows.Add(row);
            // 清空输入框
            ClearInputFields();
        }
        private void btnDel_Click(object sender, EventArgs e)
        {
            if (dataGridViewUM.SelectedRows.Count > 0)
            {
                // 确认删除
                DialogResult result = MessageBox.Show("确定要删除选中的行吗?",
                    "确认删除", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (result == DialogResult.Yes)
                {
                    foreach (DataGridViewRow row in dataGridViewUM.SelectedRows)
                    {
                        dataGridViewUM.Rows.Remove(row);
                    }
                }
            }
            else
            {
                MessageBox.Show("请先选择要删除的行!", "提示",
                    MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
    }
}
LB_SmartVision/VisionForm.Designer.cs
@@ -109,6 +109,11 @@
            tlp_MainView.TabIndex = 1;
            tlp_MainView.TagString = null;
            // 
            sc_VisionMainViewer.Panel2.Controls.Add(materialTabControl);
            sc_VisionMainViewer.Size = new Size(1776, 873);
            sc_VisionMainViewer.SplitterDistance = 124;
            sc_VisionMainViewer.SplitterWidth = 5;
            sc_VisionMainViewer.TabIndex = 0;
            // materialTabControl
            // 
            materialTabControl.AccessibleRole = AccessibleRole.Sound;