Browse Source

核对规则操作添加权限

yhluo 1 week ago
parent
commit
c6de068abc
2 changed files with 16 additions and 5 deletions
  1. 2 2
      UAS_Tools_HY/Main.cs
  2. 14 3
      UAS_Tools_HY/RulesList.cs

+ 2 - 2
UAS_Tools_HY/Main.cs

@@ -773,7 +773,7 @@ namespace UAS_MES_Tools
                 } 
                 } 
             }
             }
 
 
-            Form rulesList = new RulesList("Add",_UserName);
+            Form rulesList = new RulesList("Add",_UserName, _Account);
             if (rulesList.ShowDialog() == DialogResult.OK)
             if (rulesList.ShowDialog() == DialogResult.OK)
             {
             {
                 MessageBox.Show("新增规则成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 MessageBox.Show("新增规则成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
@@ -835,7 +835,7 @@ namespace UAS_MES_Tools
                             filterStr.Append($" and instr(RULE_VALUE, '{rulesInput2.Text}') > 0");
                             filterStr.Append($" and instr(RULE_VALUE, '{rulesInput2.Text}') > 0");
                         }
                         }
                     }
                     }
-                    Form rulesList = new RulesList("Modify",RULE_ID, _UserName);
+                    Form rulesList = new RulesList("Modify",RULE_ID, _UserName, _Account);
                     if (rulesList.ShowDialog() == DialogResult.OK)
                     if (rulesList.ShowDialog() == DialogResult.OK)
                     {
                     {
                         MessageBox.Show("修改规则成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                         MessageBox.Show("修改规则成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);

+ 14 - 3
UAS_Tools_HY/RulesList.cs

@@ -14,26 +14,37 @@ namespace UAS_Tools_HY
 {
 {
     public partial class RulesList : Form
     public partial class RulesList : Form
     {
     {
-        public RulesList(string type,string userName)
+        public RulesList(string type,string userName, string account)
         {
         {
             InitializeComponent();
             InitializeComponent();
             UserName = userName;
             UserName = userName;
             TYPE = type;
             TYPE = type;
+            Account = account;
         }
         }
 
 
-        public RulesList(string type, string ruleId, string userName)
+        public RulesList(string type, string ruleId, string userName, string account)
         {
         {
             InitializeComponent();
             InitializeComponent();
             UserName = userName;
             UserName = userName;
             RULE_ID = ruleId;
             RULE_ID = ruleId;
             TYPE = type;
             TYPE = type;
+            Account = account;
         }
         }
         
         
-        string TYPE,RULE_ID,UserName;
+        string TYPE,RULE_ID,UserName,Account;
         DataTable dt;
         DataTable dt;
 
 
         private void RulesList_Load(object sender, EventArgs e)
         private void RulesList_Load(object sender, EventArgs e)
         {
         {
+            dt = ConnectDB.ExecuteSelect($"SELECT * FROM employee WHERE em_code = '{Account}' AND em_checkrule = 1");
+            if (dt.Rows.Count == 0)
+            {
+                MessageBox.Show("该账户没有操作核对规则权限", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+                this.DialogResult = DialogResult.No;
+                this.Close();
+                return;
+            }
+
             dt = ConnectDB.ExecuteSelect($"SELECT * FROM g_packing_rules WHERE rule_id = '{RULE_ID}'");
             dt = ConnectDB.ExecuteSelect($"SELECT * FROM g_packing_rules WHERE rule_id = '{RULE_ID}'");
             if(dt.Rows.Count > 0)
             if(dt.Rows.Count > 0)
             {
             {