yhluo 1 周之前
父节点
当前提交
63815f0bb6

+ 1 - 1
UAS_MES_HYSX/FunctionCode/Make/Make_ParseLog.cs

@@ -439,7 +439,7 @@ namespace UAS_MES_NEW.Make
 
                     if (LogicHandler.CheckStepSNAndMacode(ma_code.Text, User.UserSourceCode, item.SN, User.UserCode, out omakeCode, out oMsid, out oErrorMessage))
                     {
-                        if (LogicHandler.SetStepResult(omakeCode, User.UserSourceCode, item.SN, "日志解析", "OK", User.UserCode, out oErrorMessage))
+                        if (LogicHandler.SetStepResult(omakeCode, User.UserSourceCode, item.SN, "日志解析", item.Result.ToUpper() == "PASS" ? "OK" :"NG", User.UserCode, out oErrorMessage))
                         {
                             string outMsg = "";
                             param.Add(omakeCode);

+ 214 - 168
UAS_Tools_HY/Main.Designer.cs

@@ -51,6 +51,14 @@
             this.settingLeftLab2 = new System.Windows.Forms.Label();
             this.settingLeftLab1 = new System.Windows.Forms.Label();
             this.checkPage3 = new System.Windows.Forms.TabPage();
+            this.RulesDatas = new System.Windows.Forms.DataGridView();
+            this.rulesDataBox = new System.Windows.Forms.Panel();
+            this.rulesAdd = new System.Windows.Forms.Button();
+            this.rulesLab2 = new System.Windows.Forms.Label();
+            this.rulesInput2 = new System.Windows.Forms.TextBox();
+            this.rulesLab1 = new System.Windows.Forms.Label();
+            this.rulesQuery = new System.Windows.Forms.Button();
+            this.rulesInput1 = new System.Windows.Forms.TextBox();
             this.checkPage4 = new System.Windows.Forms.TabPage();
             this.queryDataBox1 = new System.Windows.Forms.Panel();
             this.QDDatas = new System.Windows.Forms.DataGridView();
@@ -72,11 +80,13 @@
             this.QDlab1 = new System.Windows.Forms.Label();
             this.detailTop = new System.Windows.Forms.TableLayoutPanel();
             this.detailLeft = new System.Windows.Forms.Panel();
+            this.radio1 = new System.Windows.Forms.CheckBox();
             this.detailLeftBox = new System.Windows.Forms.TableLayoutPanel();
             this.dAll = new System.Windows.Forms.Label();
             this.dAgain = new System.Windows.Forms.Label();
             this.dSum = new System.Windows.Forms.Label();
             this.detailCarton = new System.Windows.Forms.Panel();
+            this.boxBtn = new System.Windows.Forms.Button();
             this.boxLab = new System.Windows.Forms.Label();
             this.BoxNo = new System.Windows.Forms.TextBox();
             this.dlab1 = new System.Windows.Forms.Label();
@@ -87,6 +97,8 @@
             this.SN = new System.Windows.Forms.TextBox();
             this.dlab3 = new System.Windows.Forms.Label();
             this.dCount = new System.Windows.Forms.Label();
+            this.dRules = new System.Windows.Forms.TextBox();
+            this.DRulesBtn = new System.Windows.Forms.Button();
             this.ShowMsg = new System.Windows.Forms.Label();
             this.Page2 = new System.Windows.Forms.TabPage();
             this.bottom = new System.Windows.Forms.TableLayoutPanel();
@@ -100,25 +112,15 @@
             this.Duser = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.DisCheckdcr = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.Dresult = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.radio1 = new System.Windows.Forms.CheckBox();
-            this.boxBtn = new System.Windows.Forms.Button();
-            this.DRulesBtn = new System.Windows.Forms.Button();
-            this.dRules = new System.Windows.Forms.TextBox();
-            this.rulesQuery = new System.Windows.Forms.Button();
-            this.rulesInput2 = new System.Windows.Forms.TextBox();
-            this.rulesLab1 = new System.Windows.Forms.Label();
-            this.RulesDatas = new System.Windows.Forms.DataGridView();
-            this.rulesDataBox = new System.Windows.Forms.Panel();
+            this.DRulesBtn1 = new System.Windows.Forms.Button();
+            this.ruleId = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.RulesCol1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.RulesCol2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.RulesCol3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.RulesCol4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.RulesCol5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.RulesCol6 = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.label1 = new System.Windows.Forms.Label();
-            this.textBox1 = new System.Windows.Forms.TextBox();
-            this.rulesAdd = new System.Windows.Forms.Button();
-            this.rulesUpdate = new System.Windows.Forms.Button();
+            this.dRuleslab = new System.Windows.Forms.Label();
             this.Pagination.SuspendLayout();
             this.Page1.SuspendLayout();
             this.checkPagination.SuspendLayout();
@@ -129,6 +131,8 @@
             this.checkSettingRight.SuspendLayout();
             this.checkSettingLeft.SuspendLayout();
             this.checkPage3.SuspendLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.RulesDatas)).BeginInit();
+            this.rulesDataBox.SuspendLayout();
             this.checkPage4.SuspendLayout();
             this.queryDataBox1.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.QDDatas)).BeginInit();
@@ -140,8 +144,6 @@
             this.detailSN.SuspendLayout();
             this.bottom.SuspendLayout();
             this.top.SuspendLayout();
-            ((System.ComponentModel.ISupportInitialize)(this.RulesDatas)).BeginInit();
-            this.rulesDataBox.SuspendLayout();
             this.SuspendLayout();
             // 
             // Pagination
@@ -408,6 +410,101 @@
             this.checkPage3.Text = "条码规则";
             this.checkPage3.UseVisualStyleBackColor = true;
             // 
+            // RulesDatas
+            // 
+            this.RulesDatas.AllowUserToAddRows = false;
+            this.RulesDatas.AllowUserToDeleteRows = false;
+            this.RulesDatas.AllowUserToResizeRows = false;
+            this.RulesDatas.BackgroundColor = System.Drawing.SystemColors.ControlLight;
+            this.RulesDatas.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+            this.RulesDatas.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
+            this.ruleId,
+            this.RulesCol1,
+            this.RulesCol2,
+            this.RulesCol3,
+            this.RulesCol4,
+            this.RulesCol5,
+            this.RulesCol6});
+            this.RulesDatas.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.RulesDatas.Location = new System.Drawing.Point(0, 83);
+            this.RulesDatas.MultiSelect = false;
+            this.RulesDatas.Name = "RulesDatas";
+            this.RulesDatas.ReadOnly = true;
+            this.RulesDatas.RowHeadersWidth = 62;
+            this.RulesDatas.RowTemplate.Height = 30;
+            this.RulesDatas.Size = new System.Drawing.Size(1230, 252);
+            this.RulesDatas.TabIndex = 16;
+            this.RulesDatas.CellMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.RulesDatas_CellMouseClick);
+            this.RulesDatas.CellMouseDoubleClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.RulesDatas_CellMouseDoubleClick);
+            // 
+            // rulesDataBox
+            // 
+            this.rulesDataBox.Controls.Add(this.rulesAdd);
+            this.rulesDataBox.Controls.Add(this.rulesLab2);
+            this.rulesDataBox.Controls.Add(this.rulesInput2);
+            this.rulesDataBox.Controls.Add(this.rulesLab1);
+            this.rulesDataBox.Controls.Add(this.rulesQuery);
+            this.rulesDataBox.Controls.Add(this.rulesInput1);
+            this.rulesDataBox.Dock = System.Windows.Forms.DockStyle.Top;
+            this.rulesDataBox.Location = new System.Drawing.Point(0, 0);
+            this.rulesDataBox.Name = "rulesDataBox";
+            this.rulesDataBox.Size = new System.Drawing.Size(1230, 83);
+            this.rulesDataBox.TabIndex = 17;
+            // 
+            // rulesAdd
+            // 
+            this.rulesAdd.Cursor = System.Windows.Forms.Cursors.Hand;
+            this.rulesAdd.Location = new System.Drawing.Point(90, 48);
+            this.rulesAdd.Name = "rulesAdd";
+            this.rulesAdd.Size = new System.Drawing.Size(85, 30);
+            this.rulesAdd.TabIndex = 17;
+            this.rulesAdd.Text = "新增";
+            this.rulesAdd.UseVisualStyleBackColor = true;
+            this.rulesAdd.Click += new System.EventHandler(this.rulesAdd_Click);
+            // 
+            // rulesLab2
+            // 
+            this.rulesLab2.AutoSize = true;
+            this.rulesLab2.Location = new System.Drawing.Point(368, 14);
+            this.rulesLab2.Name = "rulesLab2";
+            this.rulesLab2.Size = new System.Drawing.Size(82, 24);
+            this.rulesLab2.TabIndex = 15;
+            this.rulesLab2.Text = "规则内容";
+            // 
+            // rulesInput2
+            // 
+            this.rulesInput2.Location = new System.Drawing.Point(447, 11);
+            this.rulesInput2.Name = "rulesInput2";
+            this.rulesInput2.Size = new System.Drawing.Size(264, 31);
+            this.rulesInput2.TabIndex = 16;
+            // 
+            // rulesLab1
+            // 
+            this.rulesLab1.AutoSize = true;
+            this.rulesLab1.Location = new System.Drawing.Point(11, 14);
+            this.rulesLab1.Name = "rulesLab1";
+            this.rulesLab1.Size = new System.Drawing.Size(82, 24);
+            this.rulesLab1.TabIndex = 12;
+            this.rulesLab1.Text = "规则名称";
+            // 
+            // rulesQuery
+            // 
+            this.rulesQuery.Cursor = System.Windows.Forms.Cursors.Hand;
+            this.rulesQuery.Location = new System.Drawing.Point(184, 48);
+            this.rulesQuery.Name = "rulesQuery";
+            this.rulesQuery.Size = new System.Drawing.Size(85, 30);
+            this.rulesQuery.TabIndex = 14;
+            this.rulesQuery.Text = "获取";
+            this.rulesQuery.UseVisualStyleBackColor = true;
+            this.rulesQuery.Click += new System.EventHandler(this.rulesQuery_Click);
+            // 
+            // rulesInput1
+            // 
+            this.rulesInput1.Location = new System.Drawing.Point(90, 11);
+            this.rulesInput1.Name = "rulesInput1";
+            this.rulesInput1.Size = new System.Drawing.Size(264, 31);
+            this.rulesInput1.TabIndex = 13;
+            // 
             // checkPage4
             // 
             this.checkPage4.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
@@ -619,6 +716,8 @@
             // 
             // detailLeft
             // 
+            this.detailLeft.Controls.Add(this.dRuleslab);
+            this.detailLeft.Controls.Add(this.DRulesBtn1);
             this.detailLeft.Controls.Add(this.radio1);
             this.detailLeft.Controls.Add(this.detailLeftBox);
             this.detailLeft.Controls.Add(this.dRules);
@@ -629,6 +728,17 @@
             this.detailLeft.Size = new System.Drawing.Size(924, 197);
             this.detailLeft.TabIndex = 4;
             // 
+            // radio1
+            // 
+            this.radio1.AutoSize = true;
+            this.radio1.Cursor = System.Windows.Forms.Cursors.Hand;
+            this.radio1.Location = new System.Drawing.Point(550, 86);
+            this.radio1.Name = "radio1";
+            this.radio1.Size = new System.Drawing.Size(208, 32);
+            this.radio1.TabIndex = 5;
+            this.radio1.Text = "核对DCR过站记录";
+            this.radio1.UseVisualStyleBackColor = true;
+            // 
             // detailLeftBox
             // 
             this.detailLeftBox.ColumnCount = 4;
@@ -711,6 +821,18 @@
             this.detailCarton.Size = new System.Drawing.Size(538, 44);
             this.detailCarton.TabIndex = 5;
             // 
+            // boxBtn
+            // 
+            this.boxBtn.Cursor = System.Windows.Forms.Cursors.Hand;
+            this.boxBtn.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.boxBtn.Location = new System.Drawing.Point(457, 7);
+            this.boxBtn.Name = "boxBtn";
+            this.boxBtn.Size = new System.Drawing.Size(75, 30);
+            this.boxBtn.TabIndex = 8;
+            this.boxBtn.Text = "修改";
+            this.boxBtn.UseVisualStyleBackColor = true;
+            this.boxBtn.Click += new System.EventHandler(this.boxBtn_Click);
+            // 
             // boxLab
             // 
             this.boxLab.AutoSize = true;
@@ -816,6 +938,26 @@
             this.dCount.Text = "0/192";
             this.dCount.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
             // 
+            // dRules
+            // 
+            this.dRules.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.dRules.Location = new System.Drawing.Point(631, 5);
+            this.dRules.Name = "dRules";
+            this.dRules.Size = new System.Drawing.Size(226, 31);
+            this.dRules.TabIndex = 10;
+            // 
+            // DRulesBtn
+            // 
+            this.DRulesBtn.Cursor = System.Windows.Forms.Cursors.Hand;
+            this.DRulesBtn.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.DRulesBtn.Location = new System.Drawing.Point(787, 42);
+            this.DRulesBtn.Name = "DRulesBtn";
+            this.DRulesBtn.Size = new System.Drawing.Size(70, 30);
+            this.DRulesBtn.TabIndex = 11;
+            this.DRulesBtn.Text = "确定";
+            this.DRulesBtn.UseVisualStyleBackColor = true;
+            this.DRulesBtn.Click += new System.EventHandler(this.DRulesBtn_Click);
+            // 
             // ShowMsg
             // 
             this.ShowMsg.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
@@ -895,6 +1037,7 @@
             // 
             // DbarCode
             // 
+            this.DbarCode.DataPropertyName = "DbarCode";
             this.DbarCode.HeaderText = "条码";
             this.DbarCode.MinimumWidth = 8;
             this.DbarCode.Name = "DbarCode";
@@ -903,6 +1046,7 @@
             // 
             // DboxCode
             // 
+            this.DboxCode.DataPropertyName = "DboxCode";
             this.DboxCode.HeaderText = "箱号";
             this.DboxCode.MinimumWidth = 8;
             this.DboxCode.Name = "DboxCode";
@@ -911,6 +1055,7 @@
             // 
             // DcountCol
             // 
+            this.DcountCol.DataPropertyName = "DcountCol";
             this.DcountCol.HeaderText = "扫描次数";
             this.DcountCol.MinimumWidth = 8;
             this.DcountCol.Name = "DcountCol";
@@ -919,6 +1064,7 @@
             // 
             // DtimeCol
             // 
+            this.DtimeCol.DataPropertyName = "DtimeCol";
             this.DtimeCol.HeaderText = "扫描时间";
             this.DtimeCol.MinimumWidth = 8;
             this.DtimeCol.Name = "DtimeCol";
@@ -927,6 +1073,7 @@
             // 
             // Duser
             // 
+            this.Duser.DataPropertyName = "Duser";
             this.Duser.HeaderText = "扫描人";
             this.Duser.MinimumWidth = 8;
             this.Duser.Name = "Duser";
@@ -935,6 +1082,7 @@
             // 
             // DisCheckdcr
             // 
+            this.DisCheckdcr.DataPropertyName = "DisCheckdcr";
             this.DisCheckdcr.HeaderText = "是否核对DCR";
             this.DisCheckdcr.MinimumWidth = 8;
             this.DisCheckdcr.Name = "DisCheckdcr";
@@ -943,120 +1091,38 @@
             // 
             // Dresult
             // 
+            this.Dresult.DataPropertyName = "Dresult";
             this.Dresult.HeaderText = "扫描结果";
             this.Dresult.MinimumWidth = 8;
             this.Dresult.Name = "Dresult";
             this.Dresult.ReadOnly = true;
             this.Dresult.Width = 120;
             // 
-            // radio1
-            // 
-            this.radio1.AutoSize = true;
-            this.radio1.Cursor = System.Windows.Forms.Cursors.Hand;
-            this.radio1.Location = new System.Drawing.Point(566, 66);
-            this.radio1.Name = "radio1";
-            this.radio1.Size = new System.Drawing.Size(208, 32);
-            this.radio1.TabIndex = 5;
-            this.radio1.Text = "核对DCR过站记录";
-            this.radio1.UseVisualStyleBackColor = true;
-            // 
-            // boxBtn
-            // 
-            this.boxBtn.Cursor = System.Windows.Forms.Cursors.Hand;
-            this.boxBtn.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.boxBtn.Location = new System.Drawing.Point(457, 7);
-            this.boxBtn.Name = "boxBtn";
-            this.boxBtn.Size = new System.Drawing.Size(75, 30);
-            this.boxBtn.TabIndex = 8;
-            this.boxBtn.Text = "修改";
-            this.boxBtn.UseVisualStyleBackColor = true;
-            this.boxBtn.Click += new System.EventHandler(this.boxBtn_Click);
-            // 
-            // DRulesBtn
-            // 
-            this.DRulesBtn.Cursor = System.Windows.Forms.Cursors.Hand;
-            this.DRulesBtn.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.DRulesBtn.Location = new System.Drawing.Point(808, 7);
-            this.DRulesBtn.Name = "DRulesBtn";
-            this.DRulesBtn.Size = new System.Drawing.Size(70, 30);
-            this.DRulesBtn.TabIndex = 11;
-            this.DRulesBtn.Text = "确定";
-            this.DRulesBtn.UseVisualStyleBackColor = true;
-            // 
-            // dRules
+            // DRulesBtn1
             // 
-            this.dRules.Location = new System.Drawing.Point(566, 9);
-            this.dRules.Name = "dRules";
-            this.dRules.Size = new System.Drawing.Size(236, 35);
-            this.dRules.TabIndex = 10;
+            this.DRulesBtn1.Cursor = System.Windows.Forms.Cursors.Hand;
+            this.DRulesBtn1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.DRulesBtn1.Location = new System.Drawing.Point(707, 42);
+            this.DRulesBtn1.Name = "DRulesBtn1";
+            this.DRulesBtn1.Size = new System.Drawing.Size(70, 30);
+            this.DRulesBtn1.TabIndex = 12;
+            this.DRulesBtn1.Text = "取消";
+            this.DRulesBtn1.UseVisualStyleBackColor = true;
+            this.DRulesBtn1.Click += new System.EventHandler(this.DRulesBtn1_Click);
             // 
-            // rulesQuery
+            // ruleId
             // 
-            this.rulesQuery.Cursor = System.Windows.Forms.Cursors.Hand;
-            this.rulesQuery.Location = new System.Drawing.Point(298, 48);
-            this.rulesQuery.Name = "rulesQuery";
-            this.rulesQuery.Size = new System.Drawing.Size(85, 30);
-            this.rulesQuery.TabIndex = 14;
-            this.rulesQuery.Text = "获取";
-            this.rulesQuery.UseVisualStyleBackColor = true;
-            // 
-            // rulesInput2
-            // 
-            this.rulesInput2.Location = new System.Drawing.Point(90, 11);
-            this.rulesInput2.Name = "rulesInput2";
-            this.rulesInput2.Size = new System.Drawing.Size(264, 31);
-            this.rulesInput2.TabIndex = 13;
-            // 
-            // rulesLab1
-            // 
-            this.rulesLab1.AutoSize = true;
-            this.rulesLab1.Location = new System.Drawing.Point(11, 14);
-            this.rulesLab1.Name = "rulesLab1";
-            this.rulesLab1.Size = new System.Drawing.Size(82, 24);
-            this.rulesLab1.TabIndex = 12;
-            this.rulesLab1.Text = "规则名称";
-            // 
-            // RulesDatas
-            // 
-            this.RulesDatas.AllowUserToAddRows = false;
-            this.RulesDatas.AllowUserToDeleteRows = false;
-            this.RulesDatas.AllowUserToResizeRows = false;
-            this.RulesDatas.BackgroundColor = System.Drawing.SystemColors.ControlLight;
-            this.RulesDatas.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
-            this.RulesDatas.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
-            this.RulesCol1,
-            this.RulesCol2,
-            this.RulesCol3,
-            this.RulesCol4,
-            this.RulesCol5,
-            this.RulesCol6});
-            this.RulesDatas.Dock = System.Windows.Forms.DockStyle.Fill;
-            this.RulesDatas.Location = new System.Drawing.Point(0, 83);
-            this.RulesDatas.MultiSelect = false;
-            this.RulesDatas.Name = "RulesDatas";
-            this.RulesDatas.ReadOnly = true;
-            this.RulesDatas.RowHeadersWidth = 62;
-            this.RulesDatas.RowTemplate.Height = 30;
-            this.RulesDatas.Size = new System.Drawing.Size(1230, 252);
-            this.RulesDatas.TabIndex = 16;
-            // 
-            // rulesDataBox
-            // 
-            this.rulesDataBox.Controls.Add(this.rulesUpdate);
-            this.rulesDataBox.Controls.Add(this.rulesAdd);
-            this.rulesDataBox.Controls.Add(this.label1);
-            this.rulesDataBox.Controls.Add(this.textBox1);
-            this.rulesDataBox.Controls.Add(this.rulesLab1);
-            this.rulesDataBox.Controls.Add(this.rulesQuery);
-            this.rulesDataBox.Controls.Add(this.rulesInput2);
-            this.rulesDataBox.Dock = System.Windows.Forms.DockStyle.Top;
-            this.rulesDataBox.Location = new System.Drawing.Point(0, 0);
-            this.rulesDataBox.Name = "rulesDataBox";
-            this.rulesDataBox.Size = new System.Drawing.Size(1230, 83);
-            this.rulesDataBox.TabIndex = 17;
+            this.ruleId.DataPropertyName = "ruleId";
+            this.ruleId.HeaderText = "ruleId";
+            this.ruleId.MinimumWidth = 8;
+            this.ruleId.Name = "ruleId";
+            this.ruleId.ReadOnly = true;
+            this.ruleId.Visible = false;
+            this.ruleId.Width = 150;
             // 
             // RulesCol1
             // 
+            this.RulesCol1.DataPropertyName = "RulesCol1";
             this.RulesCol1.HeaderText = "规则名称";
             this.RulesCol1.MinimumWidth = 8;
             this.RulesCol1.Name = "RulesCol1";
@@ -1065,6 +1131,7 @@
             // 
             // RulesCol2
             // 
+            this.RulesCol2.DataPropertyName = "RulesCol2";
             this.RulesCol2.HeaderText = "规则内容";
             this.RulesCol2.MinimumWidth = 8;
             this.RulesCol2.Name = "RulesCol2";
@@ -1073,6 +1140,7 @@
             // 
             // RulesCol3
             // 
+            this.RulesCol3.DataPropertyName = "RulesCol3";
             this.RulesCol3.HeaderText = "备注";
             this.RulesCol3.MinimumWidth = 8;
             this.RulesCol3.Name = "RulesCol3";
@@ -1081,63 +1149,39 @@
             // 
             // RulesCol4
             // 
+            this.RulesCol4.DataPropertyName = "RulesCol4";
             this.RulesCol4.HeaderText = "长度";
             this.RulesCol4.MinimumWidth = 8;
             this.RulesCol4.Name = "RulesCol4";
             this.RulesCol4.ReadOnly = true;
-            this.RulesCol4.Width = 120;
+            this.RulesCol4.Width = 70;
             // 
             // RulesCol5
             // 
+            this.RulesCol5.DataPropertyName = "RulesCol5";
             this.RulesCol5.HeaderText = "更新时间";
             this.RulesCol5.MinimumWidth = 8;
             this.RulesCol5.Name = "RulesCol5";
             this.RulesCol5.ReadOnly = true;
-            this.RulesCol5.Width = 180;
+            this.RulesCol5.Width = 160;
             // 
             // RulesCol6
             // 
+            this.RulesCol6.DataPropertyName = "RulesCol6";
             this.RulesCol6.HeaderText = "操作人员";
             this.RulesCol6.MinimumWidth = 8;
             this.RulesCol6.Name = "RulesCol6";
             this.RulesCol6.ReadOnly = true;
-            this.RulesCol6.Width = 150;
+            this.RulesCol6.Width = 120;
             // 
-            // label1
+            // dRuleslab
             // 
-            this.label1.AutoSize = true;
-            this.label1.Location = new System.Drawing.Point(368, 14);
-            this.label1.Name = "label1";
-            this.label1.Size = new System.Drawing.Size(82, 24);
-            this.label1.TabIndex = 15;
-            this.label1.Text = "规则内容";
-            // 
-            // textBox1
-            // 
-            this.textBox1.Location = new System.Drawing.Point(447, 11);
-            this.textBox1.Name = "textBox1";
-            this.textBox1.Size = new System.Drawing.Size(264, 31);
-            this.textBox1.TabIndex = 16;
-            // 
-            // rulesAdd
-            // 
-            this.rulesAdd.Cursor = System.Windows.Forms.Cursors.Hand;
-            this.rulesAdd.Location = new System.Drawing.Point(90, 48);
-            this.rulesAdd.Name = "rulesAdd";
-            this.rulesAdd.Size = new System.Drawing.Size(85, 30);
-            this.rulesAdd.TabIndex = 17;
-            this.rulesAdd.Text = "新增";
-            this.rulesAdd.UseVisualStyleBackColor = true;
-            // 
-            // rulesUpdate
-            // 
-            this.rulesUpdate.Cursor = System.Windows.Forms.Cursors.Hand;
-            this.rulesUpdate.Location = new System.Drawing.Point(196, 48);
-            this.rulesUpdate.Name = "rulesUpdate";
-            this.rulesUpdate.Size = new System.Drawing.Size(85, 30);
-            this.rulesUpdate.TabIndex = 18;
-            this.rulesUpdate.Text = "修改";
-            this.rulesUpdate.UseVisualStyleBackColor = true;
+            this.dRuleslab.AutoSize = true;
+            this.dRuleslab.Location = new System.Drawing.Point(543, 7);
+            this.dRuleslab.Name = "dRuleslab";
+            this.dRuleslab.Size = new System.Drawing.Size(96, 28);
+            this.dRuleslab.TabIndex = 9;
+            this.dRuleslab.Text = "核对规则";
             // 
             // Main
             // 
@@ -1167,6 +1211,9 @@
             this.checkSettingLeft.ResumeLayout(false);
             this.checkSettingLeft.PerformLayout();
             this.checkPage3.ResumeLayout(false);
+            ((System.ComponentModel.ISupportInitialize)(this.RulesDatas)).EndInit();
+            this.rulesDataBox.ResumeLayout(false);
+            this.rulesDataBox.PerformLayout();
             this.checkPage4.ResumeLayout(false);
             this.queryDataBox1.ResumeLayout(false);
             ((System.ComponentModel.ISupportInitialize)(this.QDDatas)).EndInit();
@@ -1185,9 +1232,6 @@
             this.bottom.ResumeLayout(false);
             this.bottom.PerformLayout();
             this.top.ResumeLayout(false);
-            ((System.ComponentModel.ISupportInitialize)(this.RulesDatas)).EndInit();
-            this.rulesDataBox.ResumeLayout(false);
-            this.rulesDataBox.PerformLayout();
             this.ResumeLayout(false);
 
         }
@@ -1258,13 +1302,6 @@
         private System.Windows.Forms.Panel queryDataBox1;
         private System.Windows.Forms.Label QDlab3;
         private System.Windows.Forms.CheckBox QDcheckbox1;
-        private System.Windows.Forms.DataGridViewTextBoxColumn DbarCode;
-        private System.Windows.Forms.DataGridViewTextBoxColumn DboxCode;
-        private System.Windows.Forms.DataGridViewTextBoxColumn DcountCol;
-        private System.Windows.Forms.DataGridViewTextBoxColumn DtimeCol;
-        private System.Windows.Forms.DataGridViewTextBoxColumn Duser;
-        private System.Windows.Forms.DataGridViewTextBoxColumn DisCheckdcr;
-        private System.Windows.Forms.DataGridViewTextBoxColumn Dresult;
         private System.Windows.Forms.CheckBox radio1;
         private System.Windows.Forms.Button boxBtn;
         private System.Windows.Forms.Button DRulesBtn;
@@ -1273,16 +1310,25 @@
         private System.Windows.Forms.Panel rulesDataBox;
         private System.Windows.Forms.Label rulesLab1;
         private System.Windows.Forms.Button rulesQuery;
+        private System.Windows.Forms.TextBox rulesInput1;
+        private System.Windows.Forms.Label rulesLab2;
         private System.Windows.Forms.TextBox rulesInput2;
+        private System.Windows.Forms.Button rulesAdd;
+        private System.Windows.Forms.DataGridViewTextBoxColumn DbarCode;
+        private System.Windows.Forms.DataGridViewTextBoxColumn DboxCode;
+        private System.Windows.Forms.DataGridViewTextBoxColumn DcountCol;
+        private System.Windows.Forms.DataGridViewTextBoxColumn DtimeCol;
+        private System.Windows.Forms.DataGridViewTextBoxColumn Duser;
+        private System.Windows.Forms.DataGridViewTextBoxColumn DisCheckdcr;
+        private System.Windows.Forms.DataGridViewTextBoxColumn Dresult;
+        private System.Windows.Forms.Button DRulesBtn1;
+        private System.Windows.Forms.DataGridViewTextBoxColumn ruleId;
         private System.Windows.Forms.DataGridViewTextBoxColumn RulesCol1;
         private System.Windows.Forms.DataGridViewTextBoxColumn RulesCol2;
         private System.Windows.Forms.DataGridViewTextBoxColumn RulesCol3;
         private System.Windows.Forms.DataGridViewTextBoxColumn RulesCol4;
         private System.Windows.Forms.DataGridViewTextBoxColumn RulesCol5;
         private System.Windows.Forms.DataGridViewTextBoxColumn RulesCol6;
-        private System.Windows.Forms.Label label1;
-        private System.Windows.Forms.TextBox textBox1;
-        private System.Windows.Forms.Button rulesAdd;
-        private System.Windows.Forms.Button rulesUpdate;
+        private System.Windows.Forms.Label dRuleslab;
     }
 }

+ 208 - 23
UAS_Tools_HY/Main.cs

@@ -11,6 +11,7 @@ using System.Security.Principal;
 using System.Text;
 using System.Threading.Tasks;
 using System.Windows.Forms;
+using UAS_Tools_HY;
 using UAS_Tools_HY.PublicMethods;
 
 namespace UAS_MES_Tools
@@ -24,6 +25,8 @@ namespace UAS_MES_Tools
 
         string minTime, maxTime;
 
+        string curRule, curRuleLeng;
+
         public Main(string account, string password)
         {
             _Account = account;
@@ -58,6 +61,8 @@ namespace UAS_MES_Tools
             
             QDcheckbox1.Checked = true;
             QDdtp1.Value = QDdtp2.Value.AddDays(-1);
+
+            rulesQuery_Click(null, null);
         }
 
         private void SN_KeyDown(object sender, KeyEventArgs e)
@@ -66,22 +71,63 @@ namespace UAS_MES_Tools
 
             if (CheckEnter()) return;
 
-            bool checkRes = false;
+            bool checkRes = true;
+
+            ShowMsg.Text = "Pass";
+            ShowMsg.BackColor = Color.LawnGreen;
+            if (radio1.Checked)
+            {
+                dt = ConnectDB.ExecuteSelect($@"SELECT COUNT(1) sum FROM dcrlogexcel WHERE item = '{SN.Text.Trim()}'");
+                if (dt.Rows[0]["sum"].ToString() == "0")
+                {
+                    PlaySound("NG");
+                    ShowMsg.Text = "Fail";
+                    ShowMsg.BackColor = Color.Red;
+                    MessageBox.Show($"{SN.Text.Trim()},没有DCR测试数据", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+                    checkRes = false;
+                    return;
+                }
+            }
+
+            if (FormMethods.IsCheckSNRules(curRule, SN.Text.Trim(), curRuleLeng))
+            {
+                PlaySound("NG");
+                ShowMsg.Text = "Fail";
+                ShowMsg.BackColor = Color.Red;
+                MessageBox.Show($"{SN.Text.Trim()},不符合条码规则", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+                checkRes = false;
+                return;
+            }
+
+            if (Datas.Rows.Count > 0)
+            {
+                foreach (DataGridViewRow item in Datas.Rows)
+                {
+                    if (SN.Text.Trim() == item.Cells[0].Value.ToString())
+                    {
+                        int iCou = Convert.ToInt32(item.Cells[2].Value);
+                        iCou += 1;
+
+                        item.Cells[3].Value = currTime.Text;
+                        item.Cells[6].Value = checkRes ? "OK" : "NG";
+                    }
+                }
+            }
 
 
             DataGridViewRow row = new DataGridViewRow();
             row.CreateCells(Datas);
             row.Cells[0].Value = SN.Text.Trim();
-            row.Cells[1].Value = "";
+            row.Cells[1].Value = BoxNo.Text.Trim();
             row.Cells[2].Value = 1;
             row.Cells[3].Value = currTime.Text;
             row.Cells[4].Value = _UserName;
             row.Cells[5].Value = radio1.Checked ? "是" : "否";
             row.Cells[6].Value = checkRes ? "OK": "NG";
             Datas.Rows.Add(row);
+            PlaySound("OK");
 
             Datas.FirstDisplayedScrollingRowIndex = Datas.Rows.Count - 1;
-            PlaySound("OK");
         }
 
         private void BoxNo_KeyDown(object sender, KeyEventArgs e)
@@ -90,9 +136,6 @@ namespace UAS_MES_Tools
 
             if (CheckEnter()) return;
 
-            BoxNo.Enabled = false;
-            SN.SelectAll();
-            SN.Focus();
             if (Datas.Rows.Count > 0)
             {
                 foreach(DataGridViewRow item in Datas.Rows)
@@ -100,6 +143,10 @@ namespace UAS_MES_Tools
                     item.Cells[1].Value = BoxNo.Text.Trim();
                 }
             }
+
+            BoxNo.Enabled = false;
+            SN.SelectAll();
+            SN.Focus();
         }
 
         private bool CheckEnter()
@@ -114,6 +161,16 @@ namespace UAS_MES_Tools
                 MessageBox.Show("请维护箱内容量", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 return true;
             }
+            if (string.IsNullOrEmpty(dRules.Text))
+            {
+                MessageBox.Show("请选择条码规则", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+                return true;
+            }
+            if (dRules.Enabled)
+            {
+                MessageBox.Show("请选择确认条码规则", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+                return true;
+            }
             return false;
         }
        
@@ -171,7 +228,118 @@ namespace UAS_MES_Tools
         }
 
 
+        private void rulesAdd_Click(object sender, EventArgs e)
+        {
+            StringBuilder filterStr = new StringBuilder();
+            if (!string.IsNullOrEmpty(rulesInput1.Text))
+            {
+                filterStr.Append($"WHERE instr(RULE_NAME,'{rulesInput1.Text}') > 0");
+            }
+            if (!string.IsNullOrEmpty(rulesInput2.Text))
+            {
+                if(filterStr.Length == 0)
+                {
+                    filterStr.Append($"WHERE instr(RULE_VALUE,'{rulesInput2.Text}') > 0");
+                }
+                else
+                {
+                    filterStr.Append($" and instr(RULE_VALUE, '{rulesInput2.Text}') > 0");
+                } 
+            }
+
+            Form rulesList = new RulesList("Add",_UserName);
+            if (rulesList.ShowDialog() == DialogResult.OK)
+            {
+                MessageBox.Show("新增规则成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
+
+                dt = ConnectDB.ExecuteSelect($@"SELECT RULE_ID ruleId,RULE_NAME RulesCol1, RULE_VALUE RulesCol2, RELE_REMARK RulesCol3, 
+                    RULE_LENGTH RulesCol4,to_char(UPDATE_TIME, 'YYYY-MM-DD HH:Mi:SS') RulesCol5,UPDATE_USER RulesCol6 FROM g_packing_rules {filterStr.ToString()} order by UPDATE_TIME desc");
 
+                RulesDatas.DataSource = dt;
+            }
+        }
+
+        private void rulesQuery_Click(object sender, EventArgs e)
+        {
+            StringBuilder filterStr = new StringBuilder();
+            if (!string.IsNullOrEmpty(rulesInput1.Text))
+            {
+                filterStr.Append($"WHERE instr(RULE_NAME,'{rulesInput1.Text}') > 0");
+            }
+            if (!string.IsNullOrEmpty(rulesInput2.Text))
+            {
+                if (filterStr.Length == 0)
+                {
+                    filterStr.Append($"WHERE instr(RULE_VALUE,'{rulesInput2.Text}') > 0");
+                }
+                else
+                {
+                    filterStr.Append($" and instr(RULE_VALUE, '{rulesInput2.Text}') > 0");
+                }
+            }
+            dt = ConnectDB.ExecuteSelect($@"SELECT RULE_ID ruleId,RULE_NAME RulesCol1, RULE_VALUE RulesCol2, RELE_REMARK RulesCol3, 
+                    RULE_LENGTH RulesCol4,to_char(UPDATE_TIME, 'YYYY-MM-DD HH:Mi:SS') RulesCol5,UPDATE_USER RulesCol6 FROM g_packing_rules {filterStr.ToString()} order by UPDATE_TIME desc");
+
+            RulesDatas.DataSource = dt;
+        }
+
+        private void RulesDatas_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
+        {
+            if (e.RowIndex >= 0 && !RulesDatas.Rows[e.RowIndex].IsNewRow)
+            {
+                DataGridView dgv = sender as DataGridView;
+                if (dgv != null)
+                {
+                    DataGridViewRow selectedRow = dgv.Rows[e.RowIndex];
+                    string RULE_ID = selectedRow.Cells[0].Value.ToString();
+
+                    StringBuilder filterStr = new StringBuilder();
+                    if (!string.IsNullOrEmpty(rulesInput1.Text))
+                    {
+                        filterStr.Append($"WHERE instr(RULE_NAME,'{rulesInput1.Text}') > 0");
+                    }
+                    if (!string.IsNullOrEmpty(rulesInput2.Text))
+                    {
+                        if (filterStr.Length == 0)
+                        {
+                            filterStr.Append($"WHERE instr(RULE_VALUE,'{rulesInput2.Text}') > 0");
+                        }
+                        else
+                        {
+                            filterStr.Append($" and instr(RULE_VALUE, '{rulesInput2.Text}') > 0");
+                        }
+                    }
+                    Form rulesList = new RulesList("Modify",RULE_ID, _UserName);
+                    if (rulesList.ShowDialog() == DialogResult.OK)
+                    {
+                        MessageBox.Show("修改规则成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
+
+                        dt = ConnectDB.ExecuteSelect($@"SELECT RULE_ID ruleId,RULE_NAME RulesCol1, RULE_VALUE RulesCol2, RELE_REMARK RulesCol3, 
+                            RULE_LENGTH RulesCol4,to_char(UPDATE_TIME, 'YYYY-MM-DD HH:Mi:SS') RulesCol5,UPDATE_USER RulesCol6 FROM g_packing_rules {filterStr.ToString()} order by UPDATE_TIME desc");
+
+                        RulesDatas.DataSource = dt;
+                    }
+                }
+            }
+        }
+
+        private void RulesDatas_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
+        {
+            if (e.RowIndex >= 0 && !RulesDatas.Rows[e.RowIndex].IsNewRow)
+            {
+                DataGridView dgv = sender as DataGridView;
+                if (dgv != null)
+                {
+                    DataGridViewRow selectedRow = dgv.Rows[e.RowIndex];
+                    if (dRules.Enabled)
+                    {
+                        dRules.Text = selectedRow.Cells[1].Value.ToString();
+                        curRule = selectedRow.Cells[2].Value.ToString();
+                        curRuleLeng = selectedRow.Cells[4].Value.ToString();
+                    }
+                }
+            }
+        }
 
         private void boxBtn_Click(object sender, EventArgs e)
         {
@@ -235,6 +403,21 @@ namespace UAS_MES_Tools
             minTime = QDdtp1.Value.ToString("yyyy-mm-dd hh:mm:ss");
         }
 
+        private void DRulesBtn_Click(object sender, EventArgs e)
+        {
+            if (string.IsNullOrEmpty(dRules.Text))
+            {
+                MessageBox.Show("请选择条码规则", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+                return;
+            }
+            dRules.Enabled = false;
+        }
+
+        private void DRulesBtn1_Click(object sender, EventArgs e)
+        {
+            dRules.Enabled = true;
+        }
+
         private void QDdtp2_ValueChanged(object sender, EventArgs e)
         {
             if (QDdtp2.Value < QDdtp1.Value)
@@ -248,19 +431,10 @@ namespace UAS_MES_Tools
 
         private void PlaySound(string type)
         {
-            if (type == "OK")
-            {
-                using (var stream = UAS_Tools_HY.Properties.Resources.OK)
+            Task.Run(() => {
+                if (type == "OK")
                 {
-                    SoundPlayer player = new SoundPlayer(stream);
-                    player.Play();
-                }
-            }
-            else
-            {
-                if (string.IsNullOrEmpty(settingRightInput1.Text))
-                {
-                    using (var stream = UAS_Tools_HY.Properties.Resources.NG)
+                    using (var stream = UAS_Tools_HY.Properties.Resources.OK)
                     {
                         SoundPlayer player = new SoundPlayer(stream);
                         player.Play();
@@ -268,14 +442,25 @@ namespace UAS_MES_Tools
                 }
                 else
                 {
-                    string customPath = settingRightInput1.Text.Trim();
-                    if (File.Exists(customPath))
+                    if (string.IsNullOrEmpty(settingRightInput1.Text))
                     {
-                        SoundPlayer player = new SoundPlayer(customPath);
-                        player.Play();
+                        using (var stream = UAS_Tools_HY.Properties.Resources.NG)
+                        {
+                            SoundPlayer player = new SoundPlayer(stream);
+                            player.Play();
+                        }
+                    }
+                    else
+                    {
+                        string customPath = settingRightInput1.Text.Trim();
+                        if (File.Exists(customPath))
+                        {
+                            SoundPlayer player = new SoundPlayer(customPath);
+                            player.Play();
+                        }
                     }
                 }
-            }
+            });
         }
 
         public void loadTime_Tick(object sender, EventArgs e)

+ 3 - 0
UAS_Tools_HY/Main.resx

@@ -138,6 +138,9 @@
   <metadata name="Dresult.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
+  <metadata name="ruleId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
   <metadata name="RulesCol1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>

+ 78 - 0
UAS_Tools_HY/PublicMethods/ConnectDB.cs

@@ -58,6 +58,84 @@ namespace UAS_Tools_HY.PublicMethods
 
             return dataTable;
         }
+
+        public static int ExecuteInsert(string sqlQuery, Dictionary<string, object> parameters = null)
+        {
+            try
+            {
+                using (OracleConnection connection = new OracleConnection(ConnectionString))
+                {
+                    connection.Open();
+                    using (OracleCommand command = new OracleCommand(sqlQuery, connection))
+                    {
+                        if (parameters != null && parameters.Count > 0)
+                        {
+                            foreach (var param in parameters)
+                            {
+                                command.Parameters.Add(new OracleParameter(param.Key, param.Value ?? DBNull.Value));
+                            }
+                        }
+                        return command.ExecuteNonQuery();
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+                throw new Exception(ex.Message);
+            }
+        }
+
+        public static int ExecuteUpdate(string sqlQuery, Dictionary<string, object> parameters = null)
+        {
+            try
+            {
+                using (OracleConnection connection = new OracleConnection(ConnectionString))
+                {
+                    connection.Open();
+                    using (OracleCommand command = new OracleCommand(sqlQuery, connection))
+                    {
+                        if (parameters != null && parameters.Count > 0)
+                        {
+                            foreach (var param in parameters)
+                            {
+                                command.Parameters.Add(new OracleParameter(param.Key, param.Value ?? DBNull.Value));
+                            }
+                        }
+                        return command.ExecuteNonQuery();
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+                throw new Exception(ex.Message);
+            }
+        }
+
+        public static int ExecuteDelete(string sqlQuery, Dictionary<string, object> parameters = null)
+        {
+            try
+            {
+                using (OracleConnection connection = new OracleConnection(ConnectionString))
+                {
+                    connection.Open();
+                    using (OracleCommand command = new OracleCommand(sqlQuery, connection))
+                    {
+                        if (parameters != null && parameters.Count > 0)
+                        {
+                            foreach (var param in parameters)
+                            {
+                                command.Parameters.Add(new OracleParameter(param.Key, param.Value ?? DBNull.Value));
+                            }
+                        }
+                        return command.ExecuteNonQuery();
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+                throw new Exception(ex.Message);
+            }
+        }
     }
 }
 

+ 91 - 1
UAS_Tools_HY/PublicMethods/FormMethods.cs

@@ -4,6 +4,7 @@ using System.Data;
 using System.IO;
 using System.Linq;
 using System.Text;
+using System.Text.RegularExpressions;
 using System.Threading.Tasks;
 using System.Xml;
 
@@ -11,6 +12,95 @@ namespace UAS_MES_Tools
 {
     internal static class FormMethods
     {
-        
+        public static bool IsCheckSNRules(string Rule,string SN,string RuleLeng)
+        {
+            if (SN.Length != Convert.ToInt32(RuleLeng)) return true;
+
+            int RuleIndex = 0;
+            int SNIndex = 0;
+
+            while (RuleIndex < Rule.Length && SNIndex < SN.Length)
+            {
+                char RuleChar = Rule[RuleIndex];
+
+                if (RuleChar == '{')
+                {
+                    int endBraceIndex = Rule.IndexOf('}', RuleIndex);
+                    if (endBraceIndex == -1)
+                    {
+                        return true;
+                    }
+
+                    string content = Rule.Substring(RuleIndex + 1, endBraceIndex - RuleIndex - 1);
+
+                    if (content.Contains(","))
+                    {
+                        string[] allowedChars = content.Split(',');
+                        if (Array.IndexOf(allowedChars, SN[SNIndex].ToString()) == -1)
+                        {
+                            return true;
+                        }
+                    }
+                    else if (content == "YY")
+                    {
+                        if (SNIndex + 1 >= SN.Length) return true;
+                        string yearPart = SN.Substring(SNIndex, 2);
+                        if (!Regex.IsMatch(yearPart, @"^\d{2}$"))
+                        {
+                            return true;
+                        }
+                        SNIndex++;
+                    }
+                    else if (content == "MM")
+                    {
+                        if (SNIndex + 1 >= SN.Length) return true;
+                        string monthPart = SN.Substring(SNIndex, 2);
+                        if (!Regex.IsMatch(monthPart, @"^(0[1-9]|1[0-2])$"))
+                        {
+                            return true;
+                        }
+                        SNIndex++;
+                    }
+                    else if (content == "DD")
+                    {
+                        if (SNIndex + 1 >= SN.Length) return true;
+                        string dayPart = SN.Substring(SNIndex, 2);
+                        if (!Regex.IsMatch(dayPart, @"^(0[1-9]|[12]\d|3[01])$"))
+                        {
+                            return true;
+                        }
+                        SNIndex++;
+                    }
+                    else
+                    {
+                        return true;
+                    }
+
+
+                    RuleIndex = endBraceIndex + 1;
+                    SNIndex++;
+                }
+                else if (RuleChar == '*')
+                {
+                    RuleIndex++;
+                    SNIndex++;
+                }
+                else
+                {
+                    if (RuleChar != SN[SNIndex])
+                    {
+                        return true;
+                    }
+                    RuleIndex++;
+                    SNIndex++;
+                }
+            }
+            if (RuleIndex != Rule.Length || SNIndex != SN.Length)
+            {
+                return true;
+            }
+
+            return false;
+        }
     }
 }

+ 135 - 0
UAS_Tools_HY/RulesList.Designer.cs

@@ -0,0 +1,135 @@
+namespace UAS_Tools_HY
+{
+    partial class RulesList
+    {
+        /// <summary>
+        /// Required designer variable.
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary>
+        /// Clean up any resources being used.
+        /// </summary>
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Windows Form Designer generated code
+
+        /// <summary>
+        /// Required method for Designer support - do not modify
+        /// the contents of this method with the code editor.
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.Submit = new System.Windows.Forms.Button();
+            this.label1 = new System.Windows.Forms.Label();
+            this.label2 = new System.Windows.Forms.Label();
+            this.label3 = new System.Windows.Forms.Label();
+            this.textBox1 = new System.Windows.Forms.TextBox();
+            this.textBox2 = new System.Windows.Forms.TextBox();
+            this.textBox3 = new System.Windows.Forms.TextBox();
+            this.SuspendLayout();
+            // 
+            // Submit
+            // 
+            this.Submit.Cursor = System.Windows.Forms.Cursors.Hand;
+            this.Submit.Location = new System.Drawing.Point(227, 386);
+            this.Submit.Name = "Submit";
+            this.Submit.Size = new System.Drawing.Size(127, 46);
+            this.Submit.TabIndex = 0;
+            this.Submit.Text = "提交";
+            this.Submit.UseVisualStyleBackColor = true;
+            this.Submit.Click += new System.EventHandler(this.Submit_Click);
+            // 
+            // label1
+            // 
+            this.label1.AutoSize = true;
+            this.label1.Location = new System.Drawing.Point(51, 37);
+            this.label1.Name = "label1";
+            this.label1.Size = new System.Drawing.Size(82, 24);
+            this.label1.TabIndex = 1;
+            this.label1.Text = "规则名称";
+            // 
+            // label2
+            // 
+            this.label2.AutoSize = true;
+            this.label2.Location = new System.Drawing.Point(51, 93);
+            this.label2.Name = "label2";
+            this.label2.Size = new System.Drawing.Size(82, 24);
+            this.label2.TabIndex = 2;
+            this.label2.Text = "规则内容";
+            // 
+            // label3
+            // 
+            this.label3.AutoSize = true;
+            this.label3.Location = new System.Drawing.Point(83, 150);
+            this.label3.Name = "label3";
+            this.label3.Size = new System.Drawing.Size(46, 24);
+            this.label3.TabIndex = 3;
+            this.label3.Text = "备注";
+            // 
+            // textBox1
+            // 
+            this.textBox1.Location = new System.Drawing.Point(164, 34);
+            this.textBox1.Name = "textBox1";
+            this.textBox1.Size = new System.Drawing.Size(331, 31);
+            this.textBox1.TabIndex = 4;
+            // 
+            // textBox2
+            // 
+            this.textBox2.Location = new System.Drawing.Point(164, 90);
+            this.textBox2.Name = "textBox2";
+            this.textBox2.Size = new System.Drawing.Size(331, 31);
+            this.textBox2.TabIndex = 5;
+            // 
+            // textBox3
+            // 
+            this.textBox3.Location = new System.Drawing.Point(164, 147);
+            this.textBox3.Multiline = true;
+            this.textBox3.Name = "textBox3";
+            this.textBox3.Size = new System.Drawing.Size(331, 205);
+            this.textBox3.TabIndex = 6;
+            // 
+            // RulesList
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 24F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.ClientSize = new System.Drawing.Size(578, 444);
+            this.Controls.Add(this.textBox3);
+            this.Controls.Add(this.textBox2);
+            this.Controls.Add(this.textBox1);
+            this.Controls.Add(this.label3);
+            this.Controls.Add(this.label2);
+            this.Controls.Add(this.label1);
+            this.Controls.Add(this.Submit);
+            this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
+            this.Margin = new System.Windows.Forms.Padding(4);
+            this.MaximizeBox = false;
+            this.Name = "RulesList";
+            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
+            this.Text = "RulesList";
+            this.Load += new System.EventHandler(this.RulesList_Load);
+            this.ResumeLayout(false);
+            this.PerformLayout();
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.Button Submit;
+        private System.Windows.Forms.Label label1;
+        private System.Windows.Forms.Label label2;
+        private System.Windows.Forms.Label label3;
+        private System.Windows.Forms.TextBox textBox1;
+        private System.Windows.Forms.TextBox textBox2;
+        private System.Windows.Forms.TextBox textBox3;
+    }
+}

+ 97 - 0
UAS_Tools_HY/RulesList.cs

@@ -0,0 +1,97 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using UAS_Tools_HY.PublicMethods;
+
+namespace UAS_Tools_HY
+{
+    public partial class RulesList : Form
+    {
+        public RulesList(string type,string userName)
+        {
+            InitializeComponent();
+            UserName = userName;
+            TYPE = type;
+        }
+
+        public RulesList(string type, string ruleId, string userName)
+        {
+            InitializeComponent();
+            UserName = userName;
+            RULE_ID = ruleId;
+            TYPE = type;
+        }
+        
+        string TYPE,RULE_ID,UserName;
+        DataTable dt;
+
+        private void RulesList_Load(object sender, EventArgs e)
+        {
+            dt = ConnectDB.ExecuteSelect($"SELECT * FROM g_packing_rules WHERE rule_id = '{RULE_ID}'");
+            if(dt.Rows.Count > 0)
+            {
+                textBox1.Text = dt.Rows[0]["RULE_NAME"].ToString();
+                textBox2.Text = dt.Rows[0]["RULE_VALUE"].ToString();
+                textBox3.Text = dt.Rows[0]["RELE_REMARK"].ToString();
+
+                textBox1.Focus();
+                textBox1.SelectAll();
+            }
+        }
+
+        private void Submit_Click(object sender, EventArgs e)
+        {
+            if (string.IsNullOrEmpty(textBox1.Text))
+            {
+                MessageBox.Show("请输入规则名称", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+                return;
+            }
+            if (string.IsNullOrEmpty(textBox2.Text))
+            {
+                MessageBox.Show("请输入规则内容", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+                return;
+            }
+
+            string pattern = @"\{([^}]*)\}";
+            var matches = Regex.Matches(textBox2.Text.Trim(), pattern);
+
+            int totalLen = textBox2.Text.Trim().Length;
+            int initLen = 0;
+            int isContain = 0;
+            foreach (Match match in matches)
+            {
+                initLen += match.Length;
+
+                if (match.Value.Contains(",")){
+                    isContain += 1;
+                }
+                else
+                {
+                    isContain += match.Groups[1].Value.Length;
+                }
+            }
+            int otherLeng = totalLen - initLen + isContain;
+
+            if(TYPE == "Add")
+            {
+                int insertCount = ConnectDB.ExecuteInsert($@"INSERT INTO g_packing_rules (rule_id, rule_name, rule_value, rule_length, rele_remark, update_time, update_user) VALUES 
+                (RULEID_SEQ.nextval, '{textBox1.Text.Trim()}', '{textBox2.Text.Trim()}', '{otherLeng}', '{textBox3.Text.Trim()}', sysdate, '{UserName}')");
+            }
+            else if(TYPE == "Modify")
+            {
+                int updateCount = ConnectDB.ExecuteUpdate($@"UPDATE g_packing_rules SET rule_name = '{textBox1.Text.Trim()}',rule_value = '{textBox2.Text.Trim()}',
+                    rule_length = '{otherLeng}',rele_remark = '{textBox3.Text.Trim()}',update_time = sysdate, update_user = '{UserName}' WHERE rule_id = '{RULE_ID}'");
+            }
+            
+            this.DialogResult = DialogResult.OK;
+            this.Close();
+        }
+    }
+}

+ 120 - 0
UAS_Tools_HY/RulesList.resx

@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>

+ 9 - 0
UAS_Tools_HY/UAS_Tools_HY.csproj

@@ -89,6 +89,12 @@
     <Compile Include="PublicMethods\FormMethods.cs" />
     <Compile Include="PublicMethods\LogManager.cs" />
     <Compile Include="PublicMethods\SystemCacheClass.cs" />
+    <Compile Include="RulesList.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="RulesList.Designer.cs">
+      <DependentUpon>RulesList.cs</DependentUpon>
+    </Compile>
     <EmbeddedResource Include="Login.resx">
       <DependentUpon>Login.cs</DependentUpon>
     </EmbeddedResource>
@@ -105,6 +111,9 @@
       <DependentUpon>Resources.resx</DependentUpon>
       <DesignTime>True</DesignTime>
     </Compile>
+    <EmbeddedResource Include="RulesList.resx">
+      <DependentUpon>RulesList.cs</DependentUpon>
+    </EmbeddedResource>
     <None Include="Properties\Settings.settings">
       <Generator>SettingsSingleFileGenerator</Generator>
       <LastGenOutput>Settings.Designer.cs</LastGenOutput>