Просмотр исходного кода

修改品牌匹配策略,添加正则匹配项

章政 7 лет назад
Родитель
Сommit
049e7f966f

+ 13 - 14
UAS-出货标签管理(吉利通)/CustomerRule.Designer.cs

@@ -73,7 +73,7 @@
             // 
             this.cu_print_midprod.AutoSize = true;
             this.cu_print_midprod.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.cu_print_midprod.Location = new System.Drawing.Point(746, 376);
+            this.cu_print_midprod.Location = new System.Drawing.Point(716, 376);
             this.cu_print_midprod.Name = "cu_print_midprod";
             this.cu_print_midprod.Size = new System.Drawing.Size(125, 25);
             this.cu_print_midprod.TabIndex = 2;
@@ -85,7 +85,7 @@
             // 
             this.cu_print_midspec.AutoSize = true;
             this.cu_print_midspec.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.cu_print_midspec.Location = new System.Drawing.Point(467, 376);
+            this.cu_print_midspec.Location = new System.Drawing.Point(437, 376);
             this.cu_print_midspec.Name = "cu_print_midspec";
             this.cu_print_midspec.Size = new System.Drawing.Size(93, 25);
             this.cu_print_midspec.TabIndex = 3;
@@ -97,7 +97,7 @@
             // 
             this.cu_print_midpo.AutoSize = true;
             this.cu_print_midpo.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.cu_print_midpo.Location = new System.Drawing.Point(610, 376);
+            this.cu_print_midpo.Location = new System.Drawing.Point(580, 376);
             this.cu_print_midpo.Name = "cu_print_midpo";
             this.cu_print_midpo.Size = new System.Drawing.Size(93, 25);
             this.cu_print_midpo.TabIndex = 4;
@@ -155,7 +155,7 @@
             // 
             this.cu_print_outprod.AutoSize = true;
             this.cu_print_outprod.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.cu_print_outprod.Location = new System.Drawing.Point(746, 486);
+            this.cu_print_outprod.Location = new System.Drawing.Point(716, 472);
             this.cu_print_outprod.Name = "cu_print_outprod";
             this.cu_print_outprod.Size = new System.Drawing.Size(125, 25);
             this.cu_print_outprod.TabIndex = 47;
@@ -167,7 +167,7 @@
             // 
             this.cu_print_outpo.AutoSize = true;
             this.cu_print_outpo.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.cu_print_outpo.Location = new System.Drawing.Point(610, 486);
+            this.cu_print_outpo.Location = new System.Drawing.Point(580, 472);
             this.cu_print_outpo.Name = "cu_print_outpo";
             this.cu_print_outpo.Size = new System.Drawing.Size(93, 25);
             this.cu_print_outpo.TabIndex = 48;
@@ -179,7 +179,7 @@
             // 
             this.cu_print_outspec.AutoSize = true;
             this.cu_print_outspec.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.cu_print_outspec.Location = new System.Drawing.Point(467, 486);
+            this.cu_print_outspec.Location = new System.Drawing.Point(437, 472);
             this.cu_print_outspec.Name = "cu_print_outspec";
             this.cu_print_outspec.Size = new System.Drawing.Size(93, 25);
             this.cu_print_outspec.TabIndex = 49;
@@ -191,7 +191,7 @@
             // 
             this.cu_print_outlotno.AutoSize = true;
             this.cu_print_outlotno.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.cu_print_outlotno.Location = new System.Drawing.Point(301, 486);
+            this.cu_print_outlotno.Location = new System.Drawing.Point(301, 472);
             this.cu_print_outlotno.Name = "cu_print_outlotno";
             this.cu_print_outlotno.Size = new System.Drawing.Size(93, 25);
             this.cu_print_outlotno.TabIndex = 50;
@@ -213,7 +213,7 @@
             // 
             this.label3.AutoSize = true;
             this.label3.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label3.Location = new System.Drawing.Point(297, 446);
+            this.label3.Location = new System.Drawing.Point(297, 432);
             this.label3.Name = "label3";
             this.label3.Size = new System.Drawing.Size(106, 21);
             this.label3.TabIndex = 52;
@@ -240,7 +240,7 @@
             // 
             this.cu_print_checkonly.AutoSize = true;
             this.cu_print_checkonly.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.cu_print_checkonly.Location = new System.Drawing.Point(483, 216);
+            this.cu_print_checkonly.Location = new System.Drawing.Point(483, 220);
             this.cu_print_checkonly.Name = "cu_print_checkonly";
             this.cu_print_checkonly.Size = new System.Drawing.Size(77, 25);
             this.cu_print_checkonly.TabIndex = 56;
@@ -289,7 +289,7 @@
             this.CustProdAndSpec.AutoSize = true;
             this.CustProdAndSpec.Checked = true;
             this.CustProdAndSpec.Font = new System.Drawing.Font("微软雅黑", 12F);
-            this.CustProdAndSpec.Location = new System.Drawing.Point(5, 6);
+            this.CustProdAndSpec.Location = new System.Drawing.Point(5, 4);
             this.CustProdAndSpec.Name = "CustProdAndSpec";
             this.CustProdAndSpec.Size = new System.Drawing.Size(136, 25);
             this.CustProdAndSpec.TabIndex = 60;
@@ -301,11 +301,10 @@
             // 
             this.BarcodeAndSpec.AutoSize = true;
             this.BarcodeAndSpec.Font = new System.Drawing.Font("微软雅黑", 12F);
-            this.BarcodeAndSpec.Location = new System.Drawing.Point(168, 6);
+            this.BarcodeAndSpec.Location = new System.Drawing.Point(168, 4);
             this.BarcodeAndSpec.Name = "BarcodeAndSpec";
             this.BarcodeAndSpec.Size = new System.Drawing.Size(120, 25);
             this.BarcodeAndSpec.TabIndex = 61;
-            this.BarcodeAndSpec.TabStop = true;
             this.BarcodeAndSpec.Text = "唯一码+型号";
             this.BarcodeAndSpec.UseVisualStyleBackColor = true;
             // 
@@ -313,9 +312,9 @@
             // 
             this.groupBox1.Controls.Add(this.BarcodeAndSpec);
             this.groupBox1.Controls.Add(this.CustProdAndSpec);
-            this.groupBox1.Location = new System.Drawing.Point(410, 271);
+            this.groupBox1.Location = new System.Drawing.Point(410, 273);
             this.groupBox1.Name = "groupBox1";
-            this.groupBox1.Size = new System.Drawing.Size(294, 30);
+            this.groupBox1.Size = new System.Drawing.Size(294, 27);
             this.groupBox1.TabIndex = 62;
             this.groupBox1.TabStop = false;
             // 

+ 45 - 59
UAS-出货标签管理(吉利通)/UAS_出货标签管理.Designer.cs

@@ -74,7 +74,6 @@
             this.MidSource = new System.Windows.Forms.BindingSource(this.components);
             this.GetGridOnly = new System.Windows.Forms.CheckBox();
             this.RefreshDBConnect = new System.Windows.Forms.Timer(this.components);
-            this.AllCollected = new System.Windows.Forms.Button();
             this.label3 = new System.Windows.Forms.Label();
             this.Fresh = new System.Windows.Forms.LinkLabel();
             this.pi_cardcode_label = new System.Windows.Forms.Label();
@@ -90,9 +89,9 @@
             this.FrontCollect = new UAS_LabelMachine.CustomControl.EnterTextBox();
             this.CollectionProcess = new UAS_LabelMachine.CustomControl.GroupBoxWithBorder.GroupBoxWithBorder();
             this.groupBox2 = new System.Windows.Forms.GroupBox();
-            this.radioButton7 = new System.Windows.Forms.RadioButton();
-            this.radioButton6 = new System.Windows.Forms.RadioButton();
-            this.radioButton5 = new System.Windows.Forms.RadioButton();
+            this.ManualAutoCheck = new System.Windows.Forms.RadioButton();
+            this.ManualFrontCheck = new System.Windows.Forms.RadioButton();
+            this.ManualBackCheck = new System.Windows.Forms.RadioButton();
             this.groupBox1 = new System.Windows.Forms.GroupBox();
             this.ManualCollection = new System.Windows.Forms.RadioButton();
             this.AutoCollection = new System.Windows.Forms.RadioButton();
@@ -614,18 +613,6 @@
             // 
             this.RefreshDBConnect.Tick += new System.EventHandler(this.RefreshDBConnect_Tick);
             // 
-            // AllCollected
-            // 
-            this.AllCollected.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.AllCollected.Location = new System.Drawing.Point(232, 218);
-            this.AllCollected.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
-            this.AllCollected.Name = "AllCollected";
-            this.AllCollected.Size = new System.Drawing.Size(68, 26);
-            this.AllCollected.TabIndex = 75;
-            this.AllCollected.Text = "全部已采";
-            this.AllCollected.UseVisualStyleBackColor = true;
-            this.AllCollected.Click += new System.EventHandler(this.AllCollected_Click);
-            // 
             // label3
             // 
             this.label3.AutoSize = true;
@@ -729,6 +716,7 @@
             this.cu_print_regexpression.Size = new System.Drawing.Size(51, 20);
             this.cu_print_regexpression.TabIndex = 94;
             this.cu_print_regexpression.Text = "分隔符";
+            this.cu_print_regexpression.Visible = false;
             // 
             // label13
             // 
@@ -811,50 +799,50 @@
             // 
             // groupBox2
             // 
-            this.groupBox2.Controls.Add(this.radioButton7);
-            this.groupBox2.Controls.Add(this.radioButton6);
-            this.groupBox2.Controls.Add(this.radioButton5);
+            this.groupBox2.Controls.Add(this.ManualAutoCheck);
+            this.groupBox2.Controls.Add(this.ManualFrontCheck);
+            this.groupBox2.Controls.Add(this.ManualBackCheck);
             this.groupBox2.Location = new System.Drawing.Point(77, 177);
             this.groupBox2.Name = "groupBox2";
             this.groupBox2.Size = new System.Drawing.Size(215, 22);
             this.groupBox2.TabIndex = 97;
             this.groupBox2.TabStop = false;
             // 
-            // radioButton7
-            // 
-            this.radioButton7.AutoSize = true;
-            this.radioButton7.Font = new System.Drawing.Font("微软雅黑", 9F);
-            this.radioButton7.Location = new System.Drawing.Point(161, 3);
-            this.radioButton7.Name = "radioButton7";
-            this.radioButton7.Size = new System.Drawing.Size(50, 21);
-            this.radioButton7.TabIndex = 99;
-            this.radioButton7.TabStop = true;
-            this.radioButton7.Text = "自动";
-            this.radioButton7.UseVisualStyleBackColor = true;
-            // 
-            // radioButton6
-            // 
-            this.radioButton6.AutoSize = true;
-            this.radioButton6.Font = new System.Drawing.Font("微软雅黑", 9F);
-            this.radioButton6.Location = new System.Drawing.Point(4, 3);
-            this.radioButton6.Name = "radioButton6";
-            this.radioButton6.Size = new System.Drawing.Size(74, 21);
-            this.radioButton6.TabIndex = 96;
-            this.radioButton6.TabStop = true;
-            this.radioButton6.Text = "前端采集";
-            this.radioButton6.UseVisualStyleBackColor = true;
-            // 
-            // radioButton5
-            // 
-            this.radioButton5.AutoSize = true;
-            this.radioButton5.Font = new System.Drawing.Font("微软雅黑", 9F);
-            this.radioButton5.Location = new System.Drawing.Point(84, 3);
-            this.radioButton5.Name = "radioButton5";
-            this.radioButton5.Size = new System.Drawing.Size(74, 21);
-            this.radioButton5.TabIndex = 97;
-            this.radioButton5.TabStop = true;
-            this.radioButton5.Text = "后端扫描";
-            this.radioButton5.UseVisualStyleBackColor = true;
+            // ManualAutoCheck
+            // 
+            this.ManualAutoCheck.AutoSize = true;
+            this.ManualAutoCheck.Font = new System.Drawing.Font("微软雅黑", 9F);
+            this.ManualAutoCheck.Location = new System.Drawing.Point(161, 3);
+            this.ManualAutoCheck.Name = "ManualAutoCheck";
+            this.ManualAutoCheck.Size = new System.Drawing.Size(50, 21);
+            this.ManualAutoCheck.TabIndex = 99;
+            this.ManualAutoCheck.TabStop = true;
+            this.ManualAutoCheck.Text = "自动";
+            this.ManualAutoCheck.UseVisualStyleBackColor = true;
+            // 
+            // ManualFrontCheck
+            // 
+            this.ManualFrontCheck.AutoSize = true;
+            this.ManualFrontCheck.Font = new System.Drawing.Font("微软雅黑", 9F);
+            this.ManualFrontCheck.Location = new System.Drawing.Point(4, 3);
+            this.ManualFrontCheck.Name = "ManualFrontCheck";
+            this.ManualFrontCheck.Size = new System.Drawing.Size(74, 21);
+            this.ManualFrontCheck.TabIndex = 96;
+            this.ManualFrontCheck.TabStop = true;
+            this.ManualFrontCheck.Text = "前端采集";
+            this.ManualFrontCheck.UseVisualStyleBackColor = true;
+            // 
+            // ManualBackCheck
+            // 
+            this.ManualBackCheck.AutoSize = true;
+            this.ManualBackCheck.Font = new System.Drawing.Font("微软雅黑", 9F);
+            this.ManualBackCheck.Location = new System.Drawing.Point(84, 3);
+            this.ManualBackCheck.Name = "ManualBackCheck";
+            this.ManualBackCheck.Size = new System.Drawing.Size(74, 21);
+            this.ManualBackCheck.TabIndex = 97;
+            this.ManualBackCheck.TabStop = true;
+            this.ManualBackCheck.Text = "后端扫描";
+            this.ManualBackCheck.UseVisualStyleBackColor = true;
             // 
             // groupBox1
             // 
@@ -2236,7 +2224,6 @@
             this.Controls.Add(this.pi_date);
             this.Controls.Add(this.ChooseAll);
             this.Controls.Add(this.GetGridOnly);
-            this.Controls.Add(this.AllCollected);
             this.Controls.Add(this.Fresh);
             this.Controls.Add(this.pi_cardcode_label);
             this.Controls.Add(this.pi_cardcode);
@@ -2406,7 +2393,6 @@
         private System.Windows.Forms.BindingSource MidSource;
         private System.Windows.Forms.CheckBox GetGridOnly;
         private System.Windows.Forms.Timer RefreshDBConnect;
-        private System.Windows.Forms.Button AllCollected;
         private System.Windows.Forms.Label label3;
         private System.Windows.Forms.LinkLabel Fresh;
         private System.Windows.Forms.Label pi_cardcode_label;
@@ -2427,10 +2413,10 @@
         private System.Windows.Forms.RadioButton RecheckCuprodcode;
         private System.Windows.Forms.RadioButton RecheckBarcode;
         private System.Windows.Forms.Label label22;
-        private System.Windows.Forms.RadioButton radioButton6;
-        private System.Windows.Forms.RadioButton radioButton5;
+        private System.Windows.Forms.RadioButton ManualFrontCheck;
+        private System.Windows.Forms.RadioButton ManualBackCheck;
         private System.Windows.Forms.Label label23;
-        private System.Windows.Forms.RadioButton radioButton7;
+        private System.Windows.Forms.RadioButton ManualAutoCheck;
         private System.Windows.Forms.CheckBox checkBox2;
         private System.Windows.Forms.Button ButtonCollectPass;
         private System.Windows.Forms.Button ButtonRecheckPass;

+ 18 - 23
UAS-出货标签管理(吉利通)/UAS_出货标签管理.cs

@@ -230,10 +230,11 @@ namespace UAS_LabelMachine
                         for (int i = 0; i < ScanGroup.Rows.Count; i++)
                         {
                             string sg_name = ScanGroup.Rows[i]["sg_name"].ToString();
+                            string sg_brand = ScanGroup.Rows[i]["sg_brand"].ToString();
                             reg = new Regex(ScanGroup.Rows[i]["sg_script"].ToString());
                             MatchCollection matchs = reg.Matches(msg);
                             int index = 0;
-                            DataTable dt = BaseUtil.filterDataTable(ScanItem, "sg_name='" + sg_name + "' and items_num=" + matchs.Count);
+                            DataTable dt = BaseUtil.filterDataTable(ScanItem, "sg_name='" + sg_name + "' and sg_brand='" + sg_brand + "' and items_num=" + matchs.Count);
                             if (dt.Rows.Count > 0)
                             {
                                 for (int j = 0; j < dt.Rows.Count; j++)
@@ -298,6 +299,7 @@ namespace UAS_LabelMachine
                         {
                             if (RecheckCuprodcode.Checked)
                             {
+                                //直接验证两个值相等
                                 if (Equal.Checked)
                                 {
                                     if (msgArr[i] == LabelInf.Rows[CurrentRowIndex].Cells["pd_custprodcode"].Value.ToString())
@@ -305,9 +307,14 @@ namespace UAS_LabelMachine
                                         checkItemCount = checkItemCount + 1;
                                     }
                                 }
+                                //验证正则匹配过之后相等
                                 else if (Expression.Checked)
                                 {
-
+                                    Regex re = new Regex(cu_print_regexpression.Text);
+                                    if (re.Match(msgArr[i]).Value == LabelInf.Rows[CurrentRowIndex].Cells["pd_custprodcode"].Value.ToString())
+                                    {
+                                        checkItemCount = checkItemCount + 1;
+                                    }
                                 }
                                 if (msgArr[i] == LabelInf.Rows[CurrentRowIndex].Cells["pd_custprodspec"].Value.ToString())
                                 {
@@ -675,15 +682,19 @@ namespace UAS_LabelMachine
                     sql.Append("select * from (select sg_brand,si_item,sg_name,si_expression,instr(sg_name,si_name) itemindex from (select sg_brand,si_item ");
                     sql.Append(",max(si_expression)si_expression,sg_name,si_name from prodiodetail left join product on pd_prodcode=pr_code left join scangroup on nvl(pd_brand,pr_brand) ");
                     sql.Append("=sg_brand left join scanitem on sg_id=si_sgid where pd_inoutno='" + pi_inoutno.Text + "' and si_enable=-1 group by ");
-                    sql.Append("sg_brand,si_item,sg_name,si_name))A left join (select count(1) items_num,sg_name from (select sg_name from prodiodetail ");
+                    sql.Append("sg_brand,si_item,sg_name,si_name))A left join (select count(1) items_num,sg_name,sg_brand from (select sg_name,sg_brand from prodiodetail ");
                     sql.Append("left join product on pd_prodcode=pr_code left join scangroup on  nvl(pd_brand,pr_brand)=sg_brand left join scanitem  ");
                     sql.Append("on sg_id=si_sgid where pd_inoutno='" + pi_inoutno.Text + "' and si_enable=-1 group by sg_brand,si_item,sg_name ");
-                    sql.Append(") group by sg_name)B on A.sg_name=b.sg_name order by A.sg_name,itemindex");
+                    sql.Append(") group by sg_name,sg_brand)B on A.sg_name=b.sg_name and A.sg_brand=B.sg_brand order by A.sg_name,itemindex");
                     ScanItem = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
-                    FrontCombo.DataSource = ScanItem;
+                    sql.Clear();
+                    sql.Append("select distinct sg_brand from prodiodetail left join product on pd_prodcode=pr_code left join scangroup on nvl(pd_brand,");
+                    sql.Append("pr_brand)=sg_brand left join scanitem on sg_id=si_sgid where pd_inoutno='" + pi_inoutno.Text + "' and si_enable=-1 ");
+                    DataTable dt1 = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
+                    FrontCombo.DataSource = dt1;
                     FrontCombo.DisplayMember = "sg_brand";
                     FrontCombo.ValueMember = "sg_brand";
-                    BackCombo.DataSource = ScanItem;
+                    BackCombo.DataSource = dt1;
                     BackCombo.DisplayMember = "sg_brand";
                     BackCombo.ValueMember = "sg_brand";
                     LoadGridData(sender, e);
@@ -1222,7 +1233,7 @@ namespace UAS_LabelMachine
                 back_sg_separator.Text = dt.Rows[0]["splitfront"].ToString();
             }
             //获取所有的匹配脚本
-            ScanGroup = (DataTable)dh.ExecuteSql("select distinct sg_script,sg_name from prodiobarcode left join scangroup on pib_brand=sg_brand where pib_inoutno='" + pi_inoutno.Text + "' and sg_id is not null", "select");
+            ScanGroup = (DataTable)dh.ExecuteSql("select distinct sg_brand,sg_script,sg_name from prodiobarcode left join scangroup on pib_brand=sg_brand where pib_inoutno='" + pi_inoutno.Text + "' and sg_id is not null", "select");
             //绑定数据之后往下找到未采集的数据显示在当前采集的栏目
             for (int i = 0; i < LabelInf.RowCount; i++)
             {
@@ -1335,22 +1346,6 @@ namespace UAS_LabelMachine
             }
         }
 
-        private void AllCollected_Click(object sender, EventArgs e)
-        {
-            if (AllCollect == false)
-            {
-                foreach (DataGridViewRow dr in LabelInf.Rows)
-                    dr.Cells["pib_ifpick"].Value = true;
-                AllCollect = true;
-            }
-            else
-            {
-                foreach (DataGridViewRow dr in LabelInf.Rows)
-                    dr.Cells["pib_ifpick"].Value = false;
-                AllCollect = false;
-            }
-        }
-
         private void LogingOut_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
         {
             string close = MessageBox.Show(this.ParentForm, "是否注销", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();