Bladeren bron

Merge repos.ubtob.net:usoft/mes-client

callm 3 dagen geleden
bovenliggende
commit
3e5e1c2fd8
4 gewijzigde bestanden met toevoegingen van 224 en 132 verwijderingen
  1. 29 12
      UAS_MES_JWS/FunctionCode/Make/Make_QueryMac.cs
  2. 112 112
      UAS_Tools_HY/Main.Designer.cs
  3. 56 5
      UAS_Tools_HY/Main.cs
  4. 27 3
      UAS_Tools_HY/PublicMethods/BaseUtil.cs

+ 29 - 12
UAS_MES_JWS/FunctionCode/Make/Make_QueryMac.cs

@@ -153,7 +153,8 @@ namespace UAS_MES_NEW.Make
                 ShowMsg(0, $"获取MAC异常: {error}");
                 return;
             }
-            if (string.IsNullOrEmpty(output))
+
+            if (!string.IsNullOrEmpty(output))
             {
                 Match match = Regex.Match(output, @"link/ether\s+([0-9a-fA-F:]{17})");
                 if (match.Success)
@@ -169,6 +170,31 @@ namespace UAS_MES_NEW.Make
                 MsgBox.BackColor = Color.LawnGreen;
                 resultType = "OK";
 
+                string omakeCode, oMsid, oErrorMessage;
+                if (LogicHandler.CheckStepSNAndMacode(WO, User.UserSourceCode, SN, User.UserCode, out omakeCode, out oMsid, out oErrorMessage))
+                {
+                    if (LogicHandler.SetStepResult(omakeCode, User.UserSourceCode, SN, "MAC比对", resultType, User.UserCode, out oErrorMessage))
+                    {
+                        LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, woVal.Text, User.UserLineCode, User.UserSourceCode, "MAC比对", "", SN, "");
+
+                        sql.Clear();
+                        sql.Append($@"INSERT INTO steptestdetail (std_id,std_sn,std_makecode,std_date,std_indate,
+                                std_rescode,std_stepcode,std_class,std_value1,STD_VALUE2,STD_TESTRESULT) values 
+                                (steptestdetail_seq.NEXTVAL,'{SN}','{woVal.Text}',sysdate,sysdate,
+                                '{User.UserSourceCode}','{User.CurrentStepCode}','MAC比对','{snCollectionBox1.Text}','{MAC}','{resultType}')");
+                        dh.ExecuteSql(sql.ToString(), "insert");
+                        ShowMsg(1, $"MAC核对成功,已处理过站并上传测试结果");
+                    }
+                    else
+                    {
+                        ShowMsg(0, $"过站处理记录NG: {oErrorMessage}");
+                    }
+                }
+                else
+                {
+                    ShowMsg(0, $"过站核对NG: {oErrorMessage}");
+                }
+
                 snCollectionBox1.Focus();
                 snCollectionBox1.SelectAll();
             }
@@ -182,15 +208,6 @@ namespace UAS_MES_NEW.Make
                 snCollectionBox1.SelectAll();
             }
 
-            LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, woVal.Text, User.UserLineCode, User.UserSourceCode, "MAC比对", "", SN, "");
-
-            sql.Clear();
-            sql.Append($@"INSERT INTO steptestdetail (std_id,std_sn,std_makecode,std_date,std_indate,
-                                std_rescode,std_stepcode,std_class,std_value1,STD_VALUE2,STD_TESTRESULT) values 
-                                (steptestdetail_seq.NEXTVAL,'{SN}','{woVal.Text}',sysdate,sysdate,
-                                '{User.UserSourceCode}','{User.CurrentStepCode}','MAC比对','{snCollectionBox1.Text}','{MAC}','{resultType}')");
-            dh.ExecuteSql(sql.ToString(), "insert");
-            ShowMsg(1, $"MAC核对成功,已上传测试结果");
 
             /*res.Items.Clear();
             res.Items.Add(output);*/
@@ -235,8 +252,8 @@ namespace UAS_MES_NEW.Make
             GetSNCode.Focus();
             GetSNCode.SelectAll();
 
-            MsgBox.Text = "Pass";
-            MsgBox.BackColor = Color.LawnGreen;
+            MsgBox.Text = "";
+            MsgBox.BackColor = SystemColors.Control;
         }
 
         private void ParseXml(string path)

+ 112 - 112
UAS_Tools_HY/Main.Designer.cs

@@ -120,14 +120,19 @@
             this.ShowMsg = new System.Windows.Forms.Label();
             this.Page2 = new System.Windows.Forms.TabPage();
             this.MsgBox = new System.Windows.Forms.ListBox();
-            this.FileDetail_Box = new System.Windows.Forms.Panel();
+            this.FileDetail_Box1 = new System.Windows.Forms.Panel();
+            this.buildConfirm = new System.Windows.Forms.Button();
+            this.handExeLab1 = new System.Windows.Forms.Label();
+            this.handExeVal = new System.Windows.Forms.TextBox();
+            this.handTimeLab = new System.Windows.Forms.Label();
             this.handPathVal = new System.Windows.Forms.TextBox();
-            this.handPathLab = new System.Windows.Forms.Label();
             this.listenVal = new System.Windows.Forms.TextBox();
+            this.handPathLab = new System.Windows.Forms.Label();
+            this.handTime = new System.Windows.Forms.DateTimePicker();
+            this.handExeLab = new System.Windows.Forms.Label();
             this.listenLab = new System.Windows.Forms.Label();
             this.buildStart = new System.Windows.Forms.Button();
-            this.handExeLab = new System.Windows.Forms.Label();
-            this.handTime = new System.Windows.Forms.DateTimePicker();
+            this.FileDetail_Box = new System.Windows.Forms.Panel();
             this.FileCountVal = new System.Windows.Forms.TextBox();
             this.FileCountLab = new System.Windows.Forms.Label();
             this.timerLab1 = new System.Windows.Forms.Label();
@@ -145,11 +150,6 @@
             this.currUser = new System.Windows.Forms.Label();
             this.currTime = new System.Windows.Forms.Label();
             this.top = new System.Windows.Forms.Panel();
-            this.FileDetail_Box1 = new System.Windows.Forms.Panel();
-            this.handTimeLab = new System.Windows.Forms.Label();
-            this.handExeVal = new System.Windows.Forms.TextBox();
-            this.handExeLab1 = new System.Windows.Forms.Label();
-            this.buildConfirm = new System.Windows.Forms.Button();
             this.Pagination.SuspendLayout();
             this.Page1.SuspendLayout();
             this.checkPagination.SuspendLayout();
@@ -172,10 +172,10 @@
             this.detailCarton.SuspendLayout();
             this.detailSN.SuspendLayout();
             this.Page2.SuspendLayout();
+            this.FileDetail_Box1.SuspendLayout();
             this.FileDetail_Box.SuspendLayout();
             this.bottom.SuspendLayout();
             this.top.SuspendLayout();
-            this.FileDetail_Box1.SuspendLayout();
             this.SuspendLayout();
             // 
             // Pagination
@@ -951,9 +951,9 @@
             this.detailLeftBox.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 28F));
             this.detailLeftBox.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 15F));
             this.detailLeftBox.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 35F));
+            this.detailLeftBox.Controls.Add(this.dSum, 3, 0);
             this.detailLeftBox.Controls.Add(this.dAll, 3, 1);
             this.detailLeftBox.Controls.Add(this.dAgain, 1, 1);
-            this.detailLeftBox.Controls.Add(this.dSum, 3, 0);
             this.detailLeftBox.Controls.Add(this.detailCarton, 0, 3);
             this.detailLeftBox.Controls.Add(this.dlab1, 0, 0);
             this.detailLeftBox.Controls.Add(this.dlab2, 2, 0);
@@ -1208,25 +1208,62 @@
             this.MsgBox.TabIndex = 0;
             this.MsgBox.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.MsgBox_DrawItem);
             // 
-            // FileDetail_Box
+            // FileDetail_Box1
             // 
-            this.FileDetail_Box.Controls.Add(this.FileCountVal);
-            this.FileDetail_Box.Controls.Add(this.FileCountLab);
-            this.FileDetail_Box.Controls.Add(this.timerLab1);
-            this.FileDetail_Box.Controls.Add(this.FtpListen);
-            this.FileDetail_Box.Controls.Add(this.FtpConnect);
-            this.FileDetail_Box.Controls.Add(this.FtpPathVal);
-            this.FileDetail_Box.Controls.Add(this.FtpPathLab);
-            this.FileDetail_Box.Controls.Add(this.FtpPwVal);
-            this.FileDetail_Box.Controls.Add(this.FtpPwLab);
-            this.FileDetail_Box.Controls.Add(this.FtpAccountVal);
-            this.FileDetail_Box.Controls.Add(this.FtpAccountLab);
-            this.FileDetail_Box.Controls.Add(this.timerVal);
-            this.FileDetail_Box.Controls.Add(this.timerLab);
-            this.FileDetail_Box.Location = new System.Drawing.Point(3, 3);
-            this.FileDetail_Box.Name = "FileDetail_Box";
-            this.FileDetail_Box.Size = new System.Drawing.Size(1240, 188);
-            this.FileDetail_Box.TabIndex = 1;
+            this.FileDetail_Box1.Controls.Add(this.buildConfirm);
+            this.FileDetail_Box1.Controls.Add(this.handExeLab1);
+            this.FileDetail_Box1.Controls.Add(this.handExeVal);
+            this.FileDetail_Box1.Controls.Add(this.handTimeLab);
+            this.FileDetail_Box1.Controls.Add(this.handPathVal);
+            this.FileDetail_Box1.Controls.Add(this.listenVal);
+            this.FileDetail_Box1.Controls.Add(this.handPathLab);
+            this.FileDetail_Box1.Controls.Add(this.handTime);
+            this.FileDetail_Box1.Controls.Add(this.handExeLab);
+            this.FileDetail_Box1.Controls.Add(this.listenLab);
+            this.FileDetail_Box1.Controls.Add(this.buildStart);
+            this.FileDetail_Box1.Dock = System.Windows.Forms.DockStyle.Top;
+            this.FileDetail_Box1.Location = new System.Drawing.Point(3, 3);
+            this.FileDetail_Box1.Name = "FileDetail_Box1";
+            this.FileDetail_Box1.Size = new System.Drawing.Size(1240, 163);
+            this.FileDetail_Box1.TabIndex = 21;
+            // 
+            // buildConfirm
+            // 
+            this.buildConfirm.Cursor = System.Windows.Forms.Cursors.Hand;
+            this.buildConfirm.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.buildConfirm.Location = new System.Drawing.Point(448, 125);
+            this.buildConfirm.Name = "buildConfirm";
+            this.buildConfirm.Size = new System.Drawing.Size(100, 31);
+            this.buildConfirm.TabIndex = 24;
+            this.buildConfirm.Text = "确定";
+            this.buildConfirm.UseVisualStyleBackColor = true;
+            this.buildConfirm.Click += new System.EventHandler(this.buildConfirm_Click);
+            // 
+            // handExeLab1
+            // 
+            this.handExeLab1.AutoSize = true;
+            this.handExeLab1.Location = new System.Drawing.Point(188, 11);
+            this.handExeLab1.Name = "handExeLab1";
+            this.handExeLab1.Size = new System.Drawing.Size(54, 28);
+            this.handExeLab1.TabIndex = 23;
+            this.handExeLab1.Text = "分钟";
+            // 
+            // handExeVal
+            // 
+            this.handExeVal.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.handExeVal.Location = new System.Drawing.Point(120, 9);
+            this.handExeVal.Name = "handExeVal";
+            this.handExeVal.Size = new System.Drawing.Size(62, 31);
+            this.handExeVal.TabIndex = 22;
+            // 
+            // handTimeLab
+            // 
+            this.handTimeLab.AutoSize = true;
+            this.handTimeLab.Location = new System.Drawing.Point(13, 51);
+            this.handTimeLab.Name = "handTimeLab";
+            this.handTimeLab.Size = new System.Drawing.Size(101, 28);
+            this.handTimeLab.TabIndex = 21;
+            this.handTimeLab.Text = "当前时段:";
             // 
             // handPathVal
             // 
@@ -1237,6 +1274,15 @@
             this.handPathVal.TabIndex = 20;
             this.handPathVal.Click += new System.EventHandler(this.handPathVal_Click);
             // 
+            // listenVal
+            // 
+            this.listenVal.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.listenVal.Location = new System.Drawing.Point(120, 89);
+            this.listenVal.Name = "listenVal";
+            this.listenVal.Size = new System.Drawing.Size(322, 31);
+            this.listenVal.TabIndex = 18;
+            this.listenVal.Click += new System.EventHandler(this.listenVal_Click);
+            // 
             // handPathLab
             // 
             this.handPathLab.AutoSize = true;
@@ -1246,14 +1292,24 @@
             this.handPathLab.TabIndex = 19;
             this.handPathLab.Text = "导出路径:";
             // 
-            // listenVal
+            // handTime
             // 
-            this.listenVal.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.listenVal.Location = new System.Drawing.Point(120, 89);
-            this.listenVal.Name = "listenVal";
-            this.listenVal.Size = new System.Drawing.Size(322, 31);
-            this.listenVal.TabIndex = 18;
-            this.listenVal.Click += new System.EventHandler(this.listenVal_Click);
+            this.handTime.CustomFormat = "yyyy-MM-dd HH";
+            this.handTime.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
+            this.handTime.Location = new System.Drawing.Point(120, 46);
+            this.handTime.Name = "handTime";
+            this.handTime.ShowUpDown = true;
+            this.handTime.Size = new System.Drawing.Size(185, 35);
+            this.handTime.TabIndex = 14;
+            // 
+            // handExeLab
+            // 
+            this.handExeLab.AutoSize = true;
+            this.handExeLab.Location = new System.Drawing.Point(13, 11);
+            this.handExeLab.Name = "handExeLab";
+            this.handExeLab.Size = new System.Drawing.Size(143, 28);
+            this.handExeLab.TabIndex = 15;
+            this.handExeLab.Text = "处理间隔时间:";
             // 
             // listenLab
             // 
@@ -1276,24 +1332,25 @@
             this.buildStart.UseVisualStyleBackColor = true;
             this.buildStart.Click += new System.EventHandler(this.buildStart_Click);
             // 
-            // handExeLab
-            // 
-            this.handExeLab.AutoSize = true;
-            this.handExeLab.Location = new System.Drawing.Point(13, 11);
-            this.handExeLab.Name = "handExeLab";
-            this.handExeLab.Size = new System.Drawing.Size(143, 28);
-            this.handExeLab.TabIndex = 15;
-            this.handExeLab.Text = "处理间隔时间:";
-            // 
-            // handTime
+            // FileDetail_Box
             // 
-            this.handTime.CustomFormat = "yyyy-MM-dd HH";
-            this.handTime.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
-            this.handTime.Location = new System.Drawing.Point(120, 46);
-            this.handTime.Name = "handTime";
-            this.handTime.ShowUpDown = true;
-            this.handTime.Size = new System.Drawing.Size(185, 35);
-            this.handTime.TabIndex = 14;
+            this.FileDetail_Box.Controls.Add(this.FileCountVal);
+            this.FileDetail_Box.Controls.Add(this.FileCountLab);
+            this.FileDetail_Box.Controls.Add(this.timerLab1);
+            this.FileDetail_Box.Controls.Add(this.FtpListen);
+            this.FileDetail_Box.Controls.Add(this.FtpConnect);
+            this.FileDetail_Box.Controls.Add(this.FtpPathVal);
+            this.FileDetail_Box.Controls.Add(this.FtpPathLab);
+            this.FileDetail_Box.Controls.Add(this.FtpPwVal);
+            this.FileDetail_Box.Controls.Add(this.FtpPwLab);
+            this.FileDetail_Box.Controls.Add(this.FtpAccountVal);
+            this.FileDetail_Box.Controls.Add(this.FtpAccountLab);
+            this.FileDetail_Box.Controls.Add(this.timerVal);
+            this.FileDetail_Box.Controls.Add(this.timerLab);
+            this.FileDetail_Box.Location = new System.Drawing.Point(3, 3);
+            this.FileDetail_Box.Name = "FileDetail_Box";
+            this.FileDetail_Box.Size = new System.Drawing.Size(1240, 188);
+            this.FileDetail_Box.TabIndex = 1;
             // 
             // FileCountVal
             // 
@@ -1474,63 +1531,6 @@
             this.top.Size = new System.Drawing.Size(1254, 625);
             this.top.TabIndex = 3;
             // 
-            // FileDetail_Box1
-            // 
-            this.FileDetail_Box1.Controls.Add(this.buildConfirm);
-            this.FileDetail_Box1.Controls.Add(this.handExeLab1);
-            this.FileDetail_Box1.Controls.Add(this.handExeVal);
-            this.FileDetail_Box1.Controls.Add(this.handTimeLab);
-            this.FileDetail_Box1.Controls.Add(this.handPathVal);
-            this.FileDetail_Box1.Controls.Add(this.listenVal);
-            this.FileDetail_Box1.Controls.Add(this.handPathLab);
-            this.FileDetail_Box1.Controls.Add(this.handTime);
-            this.FileDetail_Box1.Controls.Add(this.handExeLab);
-            this.FileDetail_Box1.Controls.Add(this.listenLab);
-            this.FileDetail_Box1.Controls.Add(this.buildStart);
-            this.FileDetail_Box1.Dock = System.Windows.Forms.DockStyle.Top;
-            this.FileDetail_Box1.Location = new System.Drawing.Point(3, 3);
-            this.FileDetail_Box1.Name = "FileDetail_Box1";
-            this.FileDetail_Box1.Size = new System.Drawing.Size(1240, 163);
-            this.FileDetail_Box1.TabIndex = 21;
-            // 
-            // handTimeLab
-            // 
-            this.handTimeLab.AutoSize = true;
-            this.handTimeLab.Location = new System.Drawing.Point(13, 51);
-            this.handTimeLab.Name = "handTimeLab";
-            this.handTimeLab.Size = new System.Drawing.Size(101, 28);
-            this.handTimeLab.TabIndex = 21;
-            this.handTimeLab.Text = "当前时段:";
-            // 
-            // handExeVal
-            // 
-            this.handExeVal.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.handExeVal.Location = new System.Drawing.Point(120, 9);
-            this.handExeVal.Name = "handExeVal";
-            this.handExeVal.Size = new System.Drawing.Size(62, 31);
-            this.handExeVal.TabIndex = 22;
-            // 
-            // handExeLab1
-            // 
-            this.handExeLab1.AutoSize = true;
-            this.handExeLab1.Location = new System.Drawing.Point(188, 11);
-            this.handExeLab1.Name = "handExeLab1";
-            this.handExeLab1.Size = new System.Drawing.Size(54, 28);
-            this.handExeLab1.TabIndex = 23;
-            this.handExeLab1.Text = "分钟";
-            // 
-            // buildConfirm
-            // 
-            this.buildConfirm.Cursor = System.Windows.Forms.Cursors.Hand;
-            this.buildConfirm.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.buildConfirm.Location = new System.Drawing.Point(448, 125);
-            this.buildConfirm.Name = "buildConfirm";
-            this.buildConfirm.Size = new System.Drawing.Size(100, 31);
-            this.buildConfirm.TabIndex = 24;
-            this.buildConfirm.Text = "确定";
-            this.buildConfirm.UseVisualStyleBackColor = true;
-            this.buildConfirm.Click += new System.EventHandler(this.buildConfirm_Click);
-            // 
             // Main
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 24F);
@@ -1578,13 +1578,13 @@
             this.detailSN.ResumeLayout(false);
             this.detailSN.PerformLayout();
             this.Page2.ResumeLayout(false);
+            this.FileDetail_Box1.ResumeLayout(false);
+            this.FileDetail_Box1.PerformLayout();
             this.FileDetail_Box.ResumeLayout(false);
             this.FileDetail_Box.PerformLayout();
             this.bottom.ResumeLayout(false);
             this.bottom.PerformLayout();
             this.top.ResumeLayout(false);
-            this.FileDetail_Box1.ResumeLayout(false);
-            this.FileDetail_Box1.PerformLayout();
             this.ResumeLayout(false);
 
         }

+ 56 - 5
UAS_Tools_HY/Main.cs

@@ -36,7 +36,7 @@ namespace UAS_MES_Tools
 
         string minTime, maxTime;
 
-        string curRule, curRuleLeng;
+        string curRuleId, curRule, curRuleLeng;
 
         int ishaveInd;
 
@@ -78,7 +78,8 @@ namespace UAS_MES_Tools
             settingLeftInput1.Text = BaseUtil.GetCacheData("SettingCount").ToString();
             settingLeftInput2.Text = BaseUtil.GetCacheData("SettingVolume").ToString();
 
-            dSum.Text = BaseUtil.GetCacheData("SettingVolume").ToString();
+            if (string.IsNullOrEmpty(BaseUtil.GetCacheData("SettingVolume").ToString())) dSum.Text = "0"; 
+            else dSum.Text = BaseUtil.GetCacheData("SettingVolume").ToString();
 
             settingRightInput1.Text = BaseUtil.GetCacheData("SettingNGPath").ToString();
             settingRightInput2.Text = BaseUtil.GetCacheData("SettingExportPath").ToString();
@@ -119,6 +120,8 @@ namespace UAS_MES_Tools
         {
             if (e.KeyCode != Keys.Enter) return;
 
+            if(checkPagination.SelectedIndex != 0) checkPagination.SelectedIndex = 0;
+
             if (CheckEnter()) return;
 
             bool checkRes = true;
@@ -199,16 +202,24 @@ namespace UAS_MES_Tools
                     {
                         SN.Focus();
                         SN.SelectAll();
+                        SN.Text = "";
                     }
                     else if (typeNum == 2)
                     {
                         SN.Text = "";
                         //BoxNo.Text = "";
                         dCount.Text = "0";
-                        Datas.Rows.Clear();
+                        //Datas.Rows.Clear();
                         BoxNo.Focus();
                         BoxNo.SelectAll();
                     }
+
+                    QDquery_Click(null, null);
+
+                    if (Datas.Rows.Count == Convert.ToInt32(settingLeftInput1.Text))
+                    {
+                        Datas.Rows.Clear();
+                    }
                 }
                 catch (Exception ex)
                 {
@@ -223,9 +234,9 @@ namespace UAS_MES_Tools
             int inputSum = Convert.ToInt32(dCount.Text);
             dCount.Text = (inputSum + 1).ToString();
             int insertCount = ConnectDB.ExecuteInsert($@"INSERT INTO g_packing_sncheck (work_order,part_no,sn,outbox_no,
-                            count,update_time,update_name,check_id,rule_name,rule_value,capacity) 
+                            count,update_time,update_name,check_id,rule_name,rule_value,capacity,ISCHECHK_DCR,rule_id) 
                             VALUES ( '', '', '{row.Cells[0].Value}', '{row.Cells[1].Value}',
-                            '{row.Cells[2].Value}',sysdate,'{_UserName}',packcheckid_seq.NEXTVAL,'{dRules.Text.Trim()}','{curRule}','{dSum.Text}' )");
+                            '{row.Cells[2].Value}',sysdate,'{_UserName}',packcheckid_seq.NEXTVAL,'{dRules.Text.Trim()}','{curRule}','{dSum.Text}','{row.Cells[5].Value}','{curRuleId}' )");
             if (Convert.ToInt32(dCount.Text) < Convert.ToInt32(dSum.Text))
             {
                 return 1;
@@ -256,6 +267,35 @@ namespace UAS_MES_Tools
         {
             if (e.KeyCode != Keys.Enter) return;
 
+            dt = ConnectDB.ExecuteSelect($@"SELECT * FROM g_packing_sncheck a,g_packing_rules b WHERE a.outbox_no = '{BoxNo.Text}' AND a.rule_id = b.rule_id");
+            if (dt.Rows.Count > 0)
+            {
+                if (Convert.ToInt32(dt.Rows[0]["CAPACITY"].ToString()) > dt.Rows.Count)
+                {
+                    dRules.Text = dt.Rows[0]["RULE_NAME"].ToString();
+                    curRule = dt.Rows[0]["RULE_VALUE"].ToString();
+                    curRuleLeng = dt.Rows[0]["RULE_ID"].ToString();
+                    dRules.Enabled = false;
+
+                    radio1.Checked = dt.Rows[0]["ISCHECHK_DCR"].ToString() == "是" ? true : false;
+                    dCount.Text = dt.Rows.Count.ToString();
+
+                    foreach (DataRow item in dt.Rows)
+                    {
+                        DataGridViewRow row = new DataGridViewRow();
+                        row.CreateCells(Datas);
+                        row.Cells[0].Value = item["SN"].ToString();
+                        row.Cells[1].Value = item["OUTBOX_NO"].ToString();
+                        row.Cells[2].Value = item["COUNT"].ToString();
+                        row.Cells[3].Value = item["UPDATE_TIME"].ToString();
+                        row.Cells[4].Value = item["UPDATE_NAME"].ToString();
+                        row.Cells[5].Value = item["ISCHECHK_DCR"].ToString();
+                        row.Cells[6].Value = "OK";
+                        Datas.Rows.Add(row);
+                    }
+                }
+            }
+
             if (CheckEnter()) return;
 
             if (Datas.Rows.Count > 0)
@@ -314,6 +354,16 @@ namespace UAS_MES_Tools
                 MessageBox.Show("请输入箱内容量", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 return;
             }
+
+            if (Convert.ToInt32(dCount.Text) > 0)
+            {
+                if(Convert.ToInt32(dSum.Text) > Convert.ToInt32(settingLeftInput2.Text))
+                {
+                    MessageBox.Show($"已扫描{Convert.ToInt32(dCount.Text)} 个产品,修改箱容量需大于{Convert.ToInt32(settingLeftInput2.Text)} ", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+                    return;
+                }
+            }
+
             BaseUtil.SetCacheData("SettingCount", settingLeftInput1.Text);
             BaseUtil.SetCacheData("SettingVolume", settingLeftInput2.Text);
 
@@ -625,6 +675,7 @@ namespace UAS_MES_Tools
                     if (dRules.Enabled)
                     {
                         dRules.Text = selectedRow.Cells[1].Value.ToString();
+                        curRuleId = selectedRow.Cells[0].Value.ToString();
                         curRule = selectedRow.Cells[2].Value.ToString();
                         curRuleLeng = selectedRow.Cells[4].Value.ToString();
                     }

+ 27 - 3
UAS_Tools_HY/PublicMethods/BaseUtil.cs

@@ -1,5 +1,6 @@
 using System;
 using System.Collections.Generic;
+using System.IO;
 using System.Linq;
 using System.Text;
 using System.Text.RegularExpressions;
@@ -64,9 +65,25 @@ namespace UAS_Tools_HY.PublicMethods
                 //根据地址读取xml文件
                 XmlDocument doc = new XmlDocument();
                 XmlReaderSettings settings = new XmlReaderSettings { CheckCharacters = false };
+
+                string appBasePath = AppDomain.CurrentDomain.BaseDirectory;
+                string cacheFolder = Path.Combine(appBasePath, "CacheFile");
+                string xmlPath = Path.Combine(cacheFolder, "CacheInfo.xml");
+                if (!Directory.Exists(cacheFolder))
+                {
+                    Directory.CreateDirectory(cacheFolder);
+                }
+                if (!File.Exists(xmlPath))
+                {
+                    XmlElement rootElement = doc.CreateElement("cacheInfo");
+                    doc.AppendChild(rootElement);
+                    doc.Save(xmlPath);
+                }
+
                 //忽略文档里面的注释
                 settings.IgnoreComments = true;
-                XmlReader reader = XmlReader.Create(SystemCacheClass.CacheFilePath, settings);
+                //XmlReader reader = XmlReader.Create(SystemCacheClass.CacheFilePath, settings);
+                XmlReader reader = XmlReader.Create(xmlPath, settings);
                 doc.Load(reader);
                 //先得到根节点
                 XmlNode rootNode = doc.SelectSingleNode("cacheInfo");
@@ -97,7 +114,8 @@ namespace UAS_Tools_HY.PublicMethods
                 }
                 //关闭Reader
                 reader.Close();
-                doc.Save(SystemCacheClass.CacheFilePath);
+                //doc.Save(SystemCacheClass.CacheFilePath);
+                doc.Save(xmlPath);
             }
             catch (Exception e)
             {
@@ -113,9 +131,15 @@ namespace UAS_Tools_HY.PublicMethods
                 //根据地址读取xml文件
                 XmlDocument doc = new XmlDocument();
                 XmlReaderSettings settings = new XmlReaderSettings { CheckCharacters = false };
+
+                string appBasePath = AppDomain.CurrentDomain.BaseDirectory;
+                string cacheFolder = Path.Combine(appBasePath, "CacheFile");
+                string xmlPath = Path.Combine(cacheFolder, "CacheInfo.xml");
+
                 //忽略文档里面的注释
                 settings.IgnoreComments = true;
-                XmlReader reader = XmlReader.Create(SystemCacheClass.CacheFilePath, settings);
+                //XmlReader reader = XmlReader.Create(SystemCacheClass.CacheFilePath, settings);
+                XmlReader reader = XmlReader.Create(xmlPath, settings);
                 doc.Load(reader);
                 //先得到根节点
                 XmlNode rootNode = doc.SelectSingleNode("cacheInfo");