소스 검색

添加支持型包含型号内容

章政 6 년 전
부모
커밋
9f89c9e15d

+ 5 - 33
UAS-出货标签管理(标签复核)/UAS_出货标签管理.Designer.cs

@@ -37,7 +37,6 @@
             this.AutoMatch = new System.Windows.Forms.CheckBox();
             this.pr_code_label = new System.Windows.Forms.Label();
             this.label24 = new System.Windows.Forms.Label();
-            this.CollectionUnit = new System.Windows.Forms.ComboBox();
             this.GenerateBarCode = new System.Windows.Forms.Button();
             this.SaveGrid = new System.Windows.Forms.Button();
             this.sg_separator_label = new System.Windows.Forms.Label();
@@ -130,7 +129,6 @@
             this.pib_datecode = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pib_qty = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pi_inoutno = new UAS_LabelMachine.CustomControl.EnterTextBox();
-            this.CollectionUnit_label = new System.Windows.Forms.Label();
             ((System.ComponentModel.ISupportInitialize)(this.Si_ItemDGV)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.MidSource)).BeginInit();
             this.CollectionProcess.SuspendLayout();
@@ -209,21 +207,6 @@
             this.label24.TabIndex = 55;
             this.label24.Text = "输入框";
             // 
-            // CollectionUnit
-            // 
-            this.CollectionUnit.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
-            this.CollectionUnit.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.CollectionUnit.FormattingEnabled = true;
-            this.CollectionUnit.Items.AddRange(new object[] {
-            "盘",
-            "盒",
-            "全部"});
-            this.CollectionUnit.Location = new System.Drawing.Point(296, 182);
-            this.CollectionUnit.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
-            this.CollectionUnit.Name = "CollectionUnit";
-            this.CollectionUnit.Size = new System.Drawing.Size(54, 25);
-            this.CollectionUnit.TabIndex = 41;
-            // 
             // GenerateBarCode
             // 
             this.GenerateBarCode.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
@@ -409,8 +392,10 @@
             // CleanInputAfterCollect
             // 
             this.CleanInputAfterCollect.AutoSize = true;
+            this.CleanInputAfterCollect.Checked = true;
+            this.CleanInputAfterCollect.CheckState = System.Windows.Forms.CheckState.Checked;
             this.CleanInputAfterCollect.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.CleanInputAfterCollect.Location = new System.Drawing.Point(231, 218);
+            this.CleanInputAfterCollect.Location = new System.Drawing.Point(232, 219);
             this.CleanInputAfterCollect.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.CleanInputAfterCollect.Name = "CleanInputAfterCollect";
             this.CleanInputAfterCollect.Size = new System.Drawing.Size(123, 21);
@@ -910,7 +895,7 @@
             this.sg_brand.TabIndex = 32;
             this.sg_brand.TableName = null;
             this.sg_brand.TextBoxEnable = false;
-            this.sg_brand.UserControlTextChanged += new UAS_LabelMachine.CustomControl.SearchTextBox.OnTextChange(this.sg_code_UserControlTextChanged);
+            this.sg_brand.UserControlTextChanged += new UAS_LabelMachine.CustomControl.SearchTextBox.OnTextChange(this.sg_brand_UserControlTextChanged);
             // 
             // MessageLog
             // 
@@ -1024,6 +1009,7 @@
             // 
             // pr_spec
             // 
+            this.pr_spec.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCellsExceptHeader;
             this.pr_spec.DataPropertyName = "pr_spec";
             this.pr_spec.HeaderText = "规格";
             this.pr_spec.MinimumWidth = 150;
@@ -1132,16 +1118,6 @@
             this.pi_inoutno.TabIndex = 2;
             this.pi_inoutno.KeyDown += new System.Windows.Forms.KeyEventHandler(this.pi_inoutno_KeyDown);
             // 
-            // CollectionUnit_label
-            // 
-            this.CollectionUnit_label.AutoSize = true;
-            this.CollectionUnit_label.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.CollectionUnit_label.Location = new System.Drawing.Point(228, 182);
-            this.CollectionUnit_label.Name = "CollectionUnit_label";
-            this.CollectionUnit_label.Size = new System.Drawing.Size(65, 20);
-            this.CollectionUnit_label.TabIndex = 56;
-            this.CollectionUnit_label.Text = "采集单位";
-            // 
             // UAS_出货标签打印
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
@@ -1167,8 +1143,6 @@
             this.Controls.Add(this.sg_separator_label);
             this.Controls.Add(this.SaveGrid);
             this.Controls.Add(this.GenerateBarCode);
-            this.Controls.Add(this.CollectionUnit_label);
-            this.Controls.Add(this.CollectionUnit);
             this.Controls.Add(this.label24);
             this.Controls.Add(this.Input);
             this.Controls.Add(this.pr_code_label);
@@ -1233,7 +1207,6 @@
         private System.Windows.Forms.Label pr_code_label;
         private CustomControl.EnterTextBox Input;
         private System.Windows.Forms.Label label24;
-        private System.Windows.Forms.ComboBox CollectionUnit;
         private System.Windows.Forms.Button GenerateBarCode;
         private System.Windows.Forms.Button SaveGrid;
         private System.Windows.Forms.Label sg_separator_label;
@@ -1303,6 +1276,5 @@
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_lotno;
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_datecode;
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_qty;
-        private System.Windows.Forms.Label CollectionUnit_label;
     }
 }

+ 29 - 63
UAS-出货标签管理(标签复核)/UAS_出货标签管理.cs

@@ -103,7 +103,7 @@ namespace UAS_LabelMachine
             sg_brand.SetValueField = new string[] { "sg_brand" };
             sg_brand.SelectField = "sg_code # 策略编号 ,sg_name # 策略名称,sg_brand # 品牌,sg_separator # 分隔符";
             sg_brand.TableName = "scangroup";
-            sg_brand.DbChange += Sg_code_DbChange;
+            sg_brand.DbChange += Sg_brand_DbChange;
 
             pr_code.FormName = Name;
             pr_code.SetValueField = new string[] { "pr_code" };
@@ -115,8 +115,6 @@ namespace UAS_LabelMachine
             cu_code.TableName = "customer";
             cu_code.SelectField = "cu_code # 客户编号,cu_name # 客户名称";
 
-
-            CollectionUnit.Text = "盘";
             Point pt = new Point();
             //禁止所有列的排序
             foreach (DataGridViewColumn dgv in LabelInf.Columns)
@@ -134,7 +132,7 @@ namespace UAS_LabelMachine
             asc.controlAutoSize(this);
         }
 
-        private void Sg_code_DbChange(object sender, EventArgs e)
+        private void Sg_brand_DbChange(object sender, EventArgs e)
         {
             DataTable dt = sg_brand.ReturnData;
             BaseUtil.SetFormValue(this.Controls, dt);
@@ -163,7 +161,7 @@ namespace UAS_LabelMachine
         {
             采集策略 form = new 采集策略(sg_brand.Text);
             form.WindowState = FormWindowState.Maximized;
-            form.FormClosed += sg_code_UserControlTextChanged;
+            form.FormClosed += sg_brand_UserControlTextChanged;
             BaseUtil.SetFormCenter(form);
             form.ShowDialog();
         }
@@ -189,7 +187,7 @@ namespace UAS_LabelMachine
         }
 
         //放大镜选择后出发的事件
-        private void sg_code_UserControlTextChanged(object sender, EventArgs e)
+        private void sg_brand_UserControlTextChanged(object sender, EventArgs e)
         {
             //取已启用的的按照采集次序排序
             DataTable dt = (DataTable)dh.ExecuteSql("select si_item,si_detno,sg_separator,si_kind,si_expression,si_expressionitem,si_index,si_indexstring,si_length from scanitem left join scangroup on si_sgid=sg_id where sg_brand='" + sg_brand.Text + "' and si_enable<>0 order by si_detno,si_innerdetno", "select");
@@ -230,7 +228,7 @@ namespace UAS_LabelMachine
             if (ScanData.ToArray().Length > 0)
             {
                 object[] arr = (ScanData.ToArray()[0] as ArrayList<string>).ToArray();
-                if (arr.Contains("MPN"))
+                if (arr.Contains("MPN") || arr.Contains("CPN"))
                 {
                     AutoMatch.CheckState = CheckState.Checked;
                     AutoMatch.Enabled = true;
@@ -292,15 +290,17 @@ namespace UAS_LabelMachine
             {
                 for (int j = 0; j < arr.Length; j++)
                 {
-                    if (LabelInf.Rows[i].Cells["pr_orispeccode"].Value.ToString() == MatchStr(arr[j].ToString(), "MPN") && LabelInf.Rows[i].Cells["pib_ifpick"].FormattedValue.ToString() != "True")
-                    {
-                        CurrentRowIndex = i;
-                        FindAutoMatch = true;
-                        break;
-                    }
-                    if (LabelInf.Rows[i].Cells["pd_custprodcode"].Value.ToString() == MatchStr(arr[j].ToString(), "CPN") && LabelInf.Rows[i].Cells["pib_ifpick"].FormattedValue.ToString() != "True")
+                    string orispeccode = LabelInf.Rows[i].Cells["pr_orispeccode"].Value.ToString();
+                    if ((MatchStr(arr[j].ToString(), "MPN").Contains(orispeccode) || MatchStr(arr[j].ToString(), "MPN").Trim().Contains(orispeccode) || orispeccode == MatchStr(arr[j].ToString(), "MPN") || LabelInf.Rows[i].Cells["pd_custprodcode"].Value.ToString() == MatchStr(arr[j].ToString(), "CPN")) && LabelInf.Rows[i].Cells["pib_ifpick"].FormattedValue.ToString() != "True")
                     {
                         CurrentRowIndex = i;
+                        if (CurrentRowIndex - 5 > 0)
+                            LabelInf.FirstDisplayedScrollingRowIndex = CurrentRowIndex - 5;
+                        else
+                            LabelInf.FirstDisplayedScrollingRowIndex = 0;
+                        Brand = LabelInf.Rows[CurrentRowIndex].Cells["pib_brand"].FormattedValue.ToString();
+                        if (Brand != "")
+                            sg_brand.Text = Brand;
                         FindAutoMatch = true;
                         break;
                     }
@@ -407,48 +407,14 @@ namespace UAS_LabelMachine
                 {
                     //如果按盒号采集,所有的此盒的均更新为
                     DataTable dt = (DataTable)MidSource.DataSource;
-                    if (CollectionUnit.Text == "盒")
-                    {
-                        for (int i = 0; i < LabelInf.RowCount; i++)
-                        {
-                            if (LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString() == LabelInf.Rows[CurrentRowIndex].Cells["pib_outboxcode1"].Value.ToString())
-                            {
-                                dt.Rows[i]["pib_lotno"] = LabelInf.Rows[CurrentRowIndex].Cells["pib_lotno"].Value;
-                                dt.Rows[i]["pib_datecode"] = LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode"].Value;
-                                dt.Rows[i]["pib_datecode1"] = LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode1"].Value;
-                                LabelInf.Rows[i].Cells["pib_ifpick"].Value = true;
-                                LabelInf.Rows[i].Cells["Choose"].Value = true;
-                                LabelInf.Invalidate();
-                                //当前行的索引随循环增长
-                                CurrentRowIndex = i;
-                            }
-                        }
-                    }
-                    else if (CollectionUnit.Text == "全部")
-                    {
-                        for (int i = 0; i < LabelInf.RowCount; i++)
-                        {
-                            dt.Rows[i]["pib_lotno"] = LabelInf.Rows[CurrentRowIndex].Cells["pib_lotno"].Value;
-                            dt.Rows[i]["pib_datecode"] = LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode"].Value;
-                            dt.Rows[i]["pib_datecode1"] = LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode1"].Value;
-                            CurrentRowIndex = i;
-                            LabelInf.Refresh();
-                            LabelInf.Rows[i].Cells["pib_ifpick"].Value = true;
-                            LabelInf.Rows[i].Cells["Choose"].Value = true;
-                            LabelInf.Invalidate();
-                        }
-                    }
-                    else
-                    {
-                        LabelInf.Rows[CurrentRowIndex].Cells["pib_ifpick"].Value = true;
-                        LabelInf.Rows[CurrentRowIndex].Cells["Choose"].Value = true;
-                        string datecode = LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode"].Value.ToString();
-                        string lotno = LabelInf.Rows[CurrentRowIndex].Cells["pib_lotno"].Value.ToString();
-                        string pib_id = LabelInf.Rows[CurrentRowIndex].Cells["pib_id1"].Value.ToString();
-                        ErrorType.Clear();
-                        dh.ExecuteSql("update prodiobarcode set pib_datecode='" + datecode + "',pib_lotno='" + lotno + "',pib_ifpick=-1 where pib_id='" + pib_id + "'", "update");
-                        LabelInf.Invalidate();
-                    }
+                    LabelInf.Rows[CurrentRowIndex].Cells["pib_ifpick"].Value = true;
+                    LabelInf.Rows[CurrentRowIndex].Cells["Choose"].Value = true;
+                    string datecode = LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode"].Value.ToString();
+                    string lotno = LabelInf.Rows[CurrentRowIndex].Cells["pib_lotno"].Value.ToString();
+                    string pib_id = LabelInf.Rows[CurrentRowIndex].Cells["pib_id1"].Value.ToString();
+                    ErrorType.Clear();
+                    dh.ExecuteSql("update prodiobarcode set pib_datecode='" + datecode + "',pib_lotno='" + lotno + "',pib_ifpick=-1 where pib_id='" + pib_id + "'", "update");
+                    LabelInf.Invalidate();
                 }
                 //采集未通过的时候
                 else
@@ -549,19 +515,19 @@ namespace UAS_LabelMachine
                             cell = LabelInf.Rows[CurrentRowIndex].Cells["pr_orispeccode"];
                             Matchstr = MatchStr(data[j], "MPN");
                             //采集的供应商号不匹配的话
-                            if (cell.Value.ToString() != Matchstr)
+                            if (cell.Value.ToString() == Matchstr || Matchstr.Trim().Contains(cell.Value.ToString()) || Matchstr.Contains(cell.Value.ToString()))
                             {
-                                ErrorType.Add("NG_MPN");
-                                CollectVeProdCodePass = false;
-                                //添加需要重绘的Cell
+                                ErrorType.Add("OK_MPN");
                                 LabelInf.Refresh();
-                                MessageLog.AppendText(">>供应商物料编号不匹配\n", Color.Red);
+                                CollectVeProdCodePass = true;
                             }
                             else
                             {
-                                ErrorType.Add("OK_MPN");
+                                ErrorType.Add("NG_MPN");
+                                CollectVeProdCodePass = false;
+                                //添加需要重绘的Cell
                                 LabelInf.Refresh();
-                                CollectVeProdCodePass = true;
+                                MessageLog.AppendText(">>供应商物料编号不匹配\n", Color.Red);
                             }
                             setdata.Remove("MPN");
                             length--;