增加"注销"按钮、刷卡登录时如果PLC连接则下发权限

This commit is contained in:
2026-09-03 11:05:15 +08:00
parent c5f24fea91
commit 6010e21c6c
4 changed files with 1645 additions and 1618 deletions
+7
View File
@@ -34,5 +34,12 @@ namespace JinYuan.Models
#region 日志文件夹名称
public const string USER_LOG = "OperaLog";
#endregion
#region PLC名称
/// <summary>
/// 组盘PLC名称
/// </summary>
public const string PLCNAME_ZUPAN = "PLC_1";
#endregion
}
}
+32 -16
View File
@@ -48,6 +48,7 @@
this.nav_Monitor = new JinYuan.ControlLib.NaviButton2();
this.nav_CPK = new JinYuan.ControlLib.NaviButton2();
this.panel1 = new AntdUI.Panel();
this.btn_logOut = new System.Windows.Forms.Button();
this.SwitchLanguage = new AntdUI.Dropdown();
this.avatar2 = new AntdUI.Avatar();
this.avMesicon = new AntdUI.Avatar();
@@ -108,7 +109,7 @@
this.pageHeader1.Location = new System.Drawing.Point(0, 0);
this.pageHeader1.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.pageHeader1.Name = "pageHeader1";
this.pageHeader1.Size = new System.Drawing.Size(1921, 116);
this.pageHeader1.Size = new System.Drawing.Size(1556, 116);
this.pageHeader1.SubText = "";
this.pageHeader1.TabIndex = 0;
this.pageHeader1.Text = "";
@@ -129,7 +130,7 @@
this.TopPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.TopPanel.Location = new System.Drawing.Point(0, 35);
this.TopPanel.Name = "TopPanel";
this.TopPanel.Size = new System.Drawing.Size(1921, 81);
this.TopPanel.Size = new System.Drawing.Size(1556, 81);
this.TopPanel.TabIndex = 16;
//
// nav_QRCode
@@ -163,7 +164,7 @@
this.nav_HistotryData.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.nav_HistotryData.IsLeft = false;
this.nav_HistotryData.IsSelected = false;
this.nav_HistotryData.Location = new System.Drawing.Point(1280, 15);
this.nav_HistotryData.Location = new System.Drawing.Point(915, 15);
this.nav_HistotryData.Margin = new System.Windows.Forms.Padding(2);
this.nav_HistotryData.Name = "nav_HistotryData";
this.nav_HistotryData.Size = new System.Drawing.Size(132, 52);
@@ -228,7 +229,7 @@
this.lblSubtitle.Location = new System.Drawing.Point(601, 3);
this.lblSubtitle.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lblSubtitle.Name = "lblSubtitle";
this.lblSubtitle.Size = new System.Drawing.Size(712, 38);
this.lblSubtitle.Size = new System.Drawing.Size(347, 38);
this.lblSubtitle.TabIndex = 2;
this.lblSubtitle.Text = "Pack and Label Management System";
this.lblSubtitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@@ -244,7 +245,7 @@
this.nav_UserInfo.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.nav_UserInfo.IsLeft = false;
this.nav_UserInfo.IsSelected = false;
this.nav_UserInfo.Location = new System.Drawing.Point(1754, 15);
this.nav_UserInfo.Location = new System.Drawing.Point(1389, 15);
this.nav_UserInfo.Margin = new System.Windows.Forms.Padding(2);
this.nav_UserInfo.Name = "nav_UserInfo";
this.nav_UserInfo.Size = new System.Drawing.Size(132, 52);
@@ -265,7 +266,7 @@
this.nav_SetSystem.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.nav_SetSystem.IsLeft = false;
this.nav_SetSystem.IsSelected = false;
this.nav_SetSystem.Location = new System.Drawing.Point(1438, 15);
this.nav_SetSystem.Location = new System.Drawing.Point(1073, 15);
this.nav_SetSystem.Margin = new System.Windows.Forms.Padding(2, 4, 2, 4);
this.nav_SetSystem.Name = "nav_SetSystem";
this.nav_SetSystem.Size = new System.Drawing.Size(132, 52);
@@ -308,7 +309,7 @@
this.nav_System.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.nav_System.IsLeft = false;
this.nav_System.IsSelected = false;
this.nav_System.Location = new System.Drawing.Point(1596, 15);
this.nav_System.Location = new System.Drawing.Point(1231, 15);
this.nav_System.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.nav_System.Name = "nav_System";
this.nav_System.Size = new System.Drawing.Size(132, 52);
@@ -367,6 +368,7 @@
// panel1
//
this.panel1.Back = System.Drawing.Color.Transparent;
this.panel1.Controls.Add(this.btn_logOut);
this.panel1.Controls.Add(this.SwitchLanguage);
this.panel1.Controls.Add(this.avatar2);
this.panel1.Controls.Add(this.avMesicon);
@@ -382,12 +384,25 @@
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(1921, 35);
this.panel1.Size = new System.Drawing.Size(1556, 35);
this.panel1.TabIndex = 15;
this.panel1.Text = "panel1";
this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Panel_MouseDown);
this.panel1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.Panel_MouseMove);
//
// btn_logOut
//
this.btn_logOut.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.btn_logOut.Font = new System.Drawing.Font("微软雅黑", 11.5F, System.Drawing.FontStyle.Bold);
this.btn_logOut.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(233)))), ((int)(((byte)(255)))));
this.btn_logOut.Location = new System.Drawing.Point(1449, -2);
this.btn_logOut.Name = "btn_logOut";
this.btn_logOut.Size = new System.Drawing.Size(68, 37);
this.btn_logOut.TabIndex = 14;
this.btn_logOut.Text = "注销";
this.btn_logOut.UseVisualStyleBackColor = true;
this.btn_logOut.Click += new System.EventHandler(this.btn_logOut_Click);
//
// SwitchLanguage
//
this.SwitchLanguage.BackActive = System.Drawing.Color.FromArgb(((int)(((byte)(195)))), ((int)(((byte)(198)))), ((int)(((byte)(202)))));
@@ -401,7 +416,7 @@
"中文",
"英文",
"匈牙利语"});
this.SwitchLanguage.Location = new System.Drawing.Point(1806, 0);
this.SwitchLanguage.Location = new System.Drawing.Point(1441, 0);
this.SwitchLanguage.Name = "SwitchLanguage";
this.SwitchLanguage.Size = new System.Drawing.Size(41, 35);
this.SwitchLanguage.TabIndex = 13;
@@ -439,7 +454,7 @@
this.btnScale.Font = new System.Drawing.Font("Microsoft YaHei UI", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnScale.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(8)))), ((int)(((byte)(8)))), ((int)(((byte)(8)))));
this.btnScale.IconSvg = resources.GetString("btnScale.IconSvg");
this.btnScale.Location = new System.Drawing.Point(1847, 0);
this.btnScale.Location = new System.Drawing.Point(1482, 0);
this.btnScale.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.btnScale.Name = "btnScale";
this.btnScale.Size = new System.Drawing.Size(37, 35);
@@ -481,7 +496,7 @@
this.btExit.Font = new System.Drawing.Font("Microsoft YaHei UI", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btExit.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
this.btExit.IconSvg = resources.GetString("btExit.IconSvg");
this.btExit.Location = new System.Drawing.Point(1884, 0);
this.btExit.Location = new System.Drawing.Point(1519, 0);
this.btExit.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.btExit.Name = "btExit";
this.btExit.Size = new System.Drawing.Size(37, 35);
@@ -767,7 +782,7 @@
this.panel5.Location = new System.Drawing.Point(0, 116);
this.panel5.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.panel5.Name = "panel5";
this.panel5.Size = new System.Drawing.Size(1921, 46);
this.panel5.Size = new System.Drawing.Size(1556, 46);
this.panel5.TabIndex = 3;
this.panel5.Text = "panel5";
//
@@ -780,7 +795,7 @@
this.panel8.Location = new System.Drawing.Point(1175, 0);
this.panel8.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.panel8.Name = "panel8";
this.panel8.Size = new System.Drawing.Size(746, 46);
this.panel8.Size = new System.Drawing.Size(381, 46);
this.panel8.TabIndex = 11;
//
// panel7
@@ -854,7 +869,7 @@
this.CorePanel.Name = "CorePanel";
this.CorePanel.Padding = new System.Windows.Forms.Padding(23, 11, 23, 11);
this.CorePanel.RightGap = 20;
this.CorePanel.Size = new System.Drawing.Size(1921, 838);
this.CorePanel.Size = new System.Drawing.Size(1556, 722);
this.CorePanel.TabIndex = 4;
this.CorePanel.TopGap = 10;
//
@@ -865,7 +880,7 @@
this.MainPanel.Location = new System.Drawing.Point(23, 11);
this.MainPanel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.MainPanel.Name = "MainPanel";
this.MainPanel.Size = new System.Drawing.Size(1875, 816);
this.MainPanel.Size = new System.Drawing.Size(1510, 700);
this.MainPanel.TabIndex = 0;
//
// contextMenuStrip1
@@ -888,7 +903,7 @@
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(14)))), ((int)(((byte)(23)))), ((int)(((byte)(38)))));
this.ClientSize = new System.Drawing.Size(1921, 1000);
this.ClientSize = new System.Drawing.Size(1556, 884);
this.Controls.Add(this.CorePanel);
this.Controls.Add(this.panel5);
this.Controls.Add(this.pageHeader1);
@@ -972,5 +987,6 @@
private SeeSharpTools.JY.GUI.LED led_PLC2State;
private System.Windows.Forms.Label label2;
private JinYuan.ControlLib.NaviButton2 nav_QRCode;
private System.Windows.Forms.Button btn_logOut;
}
}
+20 -2
View File
@@ -8,6 +8,7 @@ using JinYuan.MES.Models;
using JinYuan.Models;
using JinYuan.VirtualDataLibrary;
using Language;
using PLC;
using System;
using System.Collections.Generic;
using System.Data;
@@ -217,6 +218,13 @@ namespace LargeSquareOne
idleTimer.Start();
}
private void btn_logOut_Click(object sender, EventArgs e)
{
idleTimer.Stop();
// 处理用户超时
this.BeginInvoke(new Action(() => LoginLocalOut()));
}
private async void FrmNewMain_Load(object sender, EventArgs e)
{
@@ -532,6 +540,16 @@ namespace LargeSquareOne
this.lbl_LoginName.Text = CommonMethods.currentAdmin?.LoginName;
//登录日志
CommonMethods.AddOPLog(false, "登录成功,登录用户".Translated() + $":{CommonMethods.currentAdmin?.LoginName}," + "权限".Translated() + $":{CommonMethods.currentAdmin?.LoginLevel}");
// 如果组盘连接PLC,就下发用户权限
var zupanPlc = CommonMethods.plcDevices.FirstOrDefault(it => it.Name == ConstValue.PLCNAME_ZUPAN);
if (zupanPlc == null || !zupanPlc.IsConnected)
{
return;
}
Task.Run(async () => await ControlCenter.Instance.SendUserRightToPLCAsync(zupanPlc));
}
@@ -1052,7 +1070,7 @@ namespace LargeSquareOne
case FormNames.系统设置:
if (CommonMethods.IsLoginOk)
{
if (!CommonMethods.currentAdmin.UserManage)
if (!CommonMethods.currentAdmin.SystemSet)
{
new FrmMsgBoxOutWithAck(2, "当前登录用户权限不足!".Translated(), "权限不足".Translated()).ShowDialog();
return;
@@ -1067,7 +1085,7 @@ namespace LargeSquareOne
case FormNames.用户管理:
if (CommonMethods.IsLoginOk)
{
if (!CommonMethods.currentAdmin.SystemLog)
if (!CommonMethods.currentAdmin.UserManage)
{
new FrmMsgBoxOutWithAck(2, "当前登录用户权限不足!".Translated(), "权限不足".Translated()).ShowDialog();
return;
+1586 -1600
View File
File diff suppressed because it is too large Load Diff