增加"注销"按钮、刷卡登录时如果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
+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;