Browse Source

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

callm 3 days ago
parent
commit
23acf80c25
3 changed files with 54 additions and 23 deletions
  1. 1 1
      UAS_Tools_HY/Loading.cs
  2. 16 15
      UAS_Tools_HY/Main.Designer.cs
  3. 37 7
      UAS_Tools_HY/Main.cs

+ 1 - 1
UAS_Tools_HY/Loading.cs

@@ -51,7 +51,7 @@ namespace UAS_Tools_HY
                         Task<DataTable> task = ConnectDB.ExecuteSelectCancellableSimpleAsync(
                             sqlQuery: $@"SELECT sn dqsn,outbox_no dqoutbox_no,count dqcount,
                                 update_time dqupdate_time,update_name dqname,rule_name dqrule_name,rule_value dqrule_value
-                                FROM g_packing_sncheck {Filter} ORDER BY sn,update_time desc",
+                                FROM g_packing_sncheck {Filter} ORDER BY update_time desc",
                             cancellationToken: _cancellationTokenSource.Token);
 
                         ResultData = task.Result;

+ 16 - 15
UAS_Tools_HY/Main.Designer.cs

@@ -100,9 +100,9 @@
             this.DRulesBtn1 = new System.Windows.Forms.Button();
             this.radio1 = new System.Windows.Forms.CheckBox();
             this.detailLeftBox = new System.Windows.Forms.TableLayoutPanel();
+            this.dSum = new System.Windows.Forms.Label();
             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();
@@ -972,6 +972,20 @@
             this.detailLeftBox.Size = new System.Drawing.Size(544, 197);
             this.detailLeftBox.TabIndex = 2;
             // 
+            // dSum
+            // 
+            this.dSum.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
+            | System.Windows.Forms.AnchorStyles.Left) 
+            | System.Windows.Forms.AnchorStyles.Right)));
+            this.dSum.AutoSize = true;
+            this.dSum.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.dSum.Location = new System.Drawing.Point(355, 0);
+            this.dSum.Name = "dSum";
+            this.dSum.Size = new System.Drawing.Size(186, 49);
+            this.dSum.TabIndex = 7;
+            this.dSum.Text = "0";
+            this.dSum.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+            // 
             // dAll
             // 
             this.dAll.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
@@ -1002,20 +1016,6 @@
             this.dAgain.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
             this.dAgain.Visible = false;
             // 
-            // dSum
-            // 
-            this.dSum.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
-            | System.Windows.Forms.AnchorStyles.Left) 
-            | System.Windows.Forms.AnchorStyles.Right)));
-            this.dSum.AutoSize = true;
-            this.dSum.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.dSum.Location = new System.Drawing.Point(355, 0);
-            this.dSum.Name = "dSum";
-            this.dSum.Size = new System.Drawing.Size(186, 49);
-            this.dSum.TabIndex = 7;
-            this.dSum.Text = "0";
-            this.dSum.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
-            // 
             // detailCarton
             // 
             this.detailLeftBox.SetColumnSpan(this.detailCarton, 4);
@@ -1057,6 +1057,7 @@
             this.BoxNo.Size = new System.Drawing.Size(334, 31);
             this.BoxNo.TabIndex = 0;
             this.BoxNo.KeyDown += new System.Windows.Forms.KeyEventHandler(this.BoxNo_KeyDown);
+            this.BoxNo.Leave += new System.EventHandler(this.BoxNo_Leave);
             // 
             // dlab1
             // 

+ 37 - 7
UAS_Tools_HY/Main.cs

@@ -21,6 +21,7 @@ using System.Windows.Forms;
 using UAS_Tools_HY;
 using UAS_Tools_HY.Properties;
 using UAS_Tools_HY.PublicMethods;
+using Action = System.Action;
 using Application = Microsoft.Office.Interop.Excel.Application;
 using DataTable = System.Data.DataTable;
 using Timer = System.Windows.Forms.Timer;
@@ -263,6 +264,15 @@ namespace UAS_MES_Tools
             //}
         }
 
+        private void BoxNo_Leave(object sender, EventArgs e)
+        {
+            if (!string.IsNullOrEmpty(BoxNo.Text))
+            {
+                KeyEventArgs KeyEventArg = new KeyEventArgs(Keys.Enter);
+                BoxNo_KeyDown(null, KeyEventArg);
+            }
+        }
+
         private void BoxNo_KeyDown(object sender, KeyEventArgs e)
         {
             if (e.KeyCode != Keys.Enter) return;
@@ -274,12 +284,19 @@ namespace UAS_MES_Tools
                 {
                     dRules.Text = dt.Rows[0]["RULE_NAME"].ToString();
                     curRule = dt.Rows[0]["RULE_VALUE"].ToString();
-                    curRuleLeng = dt.Rows[0]["RULE_ID"].ToString();
+                    curRuleId = dt.Rows[0]["RULE_ID"].ToString();
+                    curRuleLeng = dt.Rows[0]["RULE_LENGTH"].ToString();
                     dRules.Enabled = false;
 
                     radio1.Checked = dt.Rows[0]["ISCHECHK_DCR"].ToString() == "是" ? true : false;
                     dCount.Text = dt.Rows.Count.ToString();
 
+                    settingLeftInput2.Text = dt.Rows[0]["CAPACITY"].ToString();
+                    dSum.Text = dt.Rows[0]["CAPACITY"].ToString();
+                    BaseUtil.SetCacheData("SettingVolume", dt.Rows[0]["CAPACITY"].ToString());
+
+                    Datas.Rows.Clear();
+
                     foreach (DataRow item in dt.Rows)
                     {
                         DataGridViewRow row = new DataGridViewRow();
@@ -294,17 +311,24 @@ namespace UAS_MES_Tools
                         Datas.Rows.Add(row);
                     }
                 }
+                else
+                {
+                    BoxNo.Focus();
+                    BoxNo.SelectAll();
+                    MessageBox.Show($"核对完成,此箱{BoxNo.Text} 已装满{dt.Rows[0]["CAPACITY"].ToString()} 个,请扫描未核对箱号", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+                    return;
+                }
             }
 
             if (CheckEnter()) return;
 
-            if (Datas.Rows.Count > 0)
+            /*if (Datas.Rows.Count > 0)
             {
                 foreach(DataGridViewRow item in Datas.Rows)
                 {
                     item.Cells[1].Value = BoxNo.Text.Trim();
                 }
-            }
+            }*/
 
             BoxNo.Enabled = false;
             SN.SelectAll();
@@ -419,10 +443,16 @@ namespace UAS_MES_Tools
 
             if(sender == null)
             {
-                dt = ConnectDB.ExecuteSelect($@"SELECT sn dqsn,outbox_no dqoutbox_no,count dqcount,
-                    update_time dqupdate_time,update_name dqname,rule_name dqrule_name,rule_value dqrule_value
-                    FROM g_packing_sncheck {filterStr.ToString()} ORDER BY sn,update_time desc");
-                QDDatas.DataSource = dt;
+                Task.Run(() =>
+                {
+                    dt = ConnectDB.ExecuteSelect($@"SELECT sn dqsn,outbox_no dqoutbox_no,count dqcount,
+                        update_time dqupdate_time,update_name dqname,rule_name dqrule_name,rule_value dqrule_value
+                        FROM g_packing_sncheck {filterStr.ToString()} ORDER BY update_time desc");
+                    this.Invoke(new Action(() =>
+                    {
+                        QDDatas.DataSource = dt;
+                    }));
+                });
             }
             else
             {