Browse Source

添加品牌字段校验

章政 7 years ago
parent
commit
2779acc6d5

+ 86 - 0
UAS-出货标签管理/CustomControl/BlurSearch.Designer.cs

@@ -0,0 +1,86 @@
+namespace UAS_LabelMachine.CustomControl
+{
+    partial class BlurSearch
+    {
+        /// <summary> 
+        /// 必需的设计器变量。
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary> 
+        /// 清理所有正在使用的资源。
+        /// </summary>
+        /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region 组件设计器生成的代码
+
+        /// <summary> 
+        /// 设计器支持所需的方法 - 不要修改
+        /// 使用代码编辑器修改此方法的内容。
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.ListBox = new System.Windows.Forms.ListBox();
+            this.EnterTextBox = new EnterTextBox();
+            this.SuspendLayout();
+            // 
+            // ListBox
+            // 
+            this.ListBox.Dock = System.Windows.Forms.DockStyle.Bottom;
+            this.ListBox.FormattingEnabled = true;
+            this.ListBox.ItemHeight = 12;
+            this.ListBox.Location = new System.Drawing.Point(0, 20);
+            this.ListBox.Margin = new System.Windows.Forms.Padding(2);
+            this.ListBox.Name = "ListBox";
+            this.ListBox.Size = new System.Drawing.Size(154, 100);
+            this.ListBox.TabIndex = 1;
+            this.ListBox.Click += new System.EventHandler(this.ListBox_Click);
+            // 
+            // EnterTextBox
+            // 
+            this.EnterTextBox.BackColor = System.Drawing.Color.White;
+            this.EnterTextBox.Dock = System.Windows.Forms.DockStyle.Top;
+            this.EnterTextBox.ID = null;
+            this.EnterTextBox.Location = new System.Drawing.Point(0, 0);
+            this.EnterTextBox.Margin = new System.Windows.Forms.Padding(2);
+            this.EnterTextBox.Name = "EnterTextBox";
+            this.EnterTextBox.Size = new System.Drawing.Size(154, 21);
+            this.EnterTextBox.Str = null;
+            this.EnterTextBox.Str1 = null;
+            this.EnterTextBox.Str2 = null;
+            this.EnterTextBox.TabIndex = 2;
+            this.EnterTextBox.TextChanged += new System.EventHandler(this.EnterTextBox_TextChanged);
+            this.EnterTextBox.Enter += new System.EventHandler(this.EnterTextBox_Enter);
+            this.EnterTextBox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.EnterTextBox_KeyDown);
+            this.EnterTextBox.Leave += new System.EventHandler(this.EnterTextBox_Leave);
+            // 
+            // BlurSearch
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.Controls.Add(this.EnterTextBox);
+            this.Controls.Add(this.ListBox);
+            this.Margin = new System.Windows.Forms.Padding(2);
+            this.Name = "BlurSearch";
+            this.Size = new System.Drawing.Size(154, 120);
+            this.Load += new System.EventHandler(this.BlurSearch_Load);
+            this.Leave += new System.EventHandler(this.BlurSearch_Leave);
+            this.ResumeLayout(false);
+            this.PerformLayout();
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.ListBox ListBox;
+        private EnterTextBox EnterTextBox;
+    }
+}

+ 244 - 0
UAS-出货标签管理/CustomControl/BlurSearch.cs

@@ -0,0 +1,244 @@
+using System;
+using System.Data;
+using System.Windows.Forms;
+using UAS_LabelMachine;
+
+namespace UAS_LabelMachine.CustomControl
+{
+    public partial class BlurSearch : UserControl
+    {
+        DataHelper dh = new DataHelper();
+
+        public delegate void OnTextChange(object sender, EventArgs e);
+
+        public delegate void OnKeyDown(object sender, KeyEventArgs e);
+
+        public event OnTextChange UserControlTextChanged;
+
+        public event OnKeyDown UserKeyDown;
+
+        string TableName1;
+
+        string Field1;
+
+        int ItemSelectIndex = 0;
+        DataTable dt;
+
+        public override string Text
+        {
+            get
+            {
+                return EnterTextBox.Text;
+            }
+
+            set
+            {
+                EnterTextBox.Text = value;
+            }
+        }
+
+        public BlurSearch()
+        {
+            InitializeComponent();
+        }
+
+        public string TableName
+        {
+            get
+            {
+                return TableName1;
+            }
+
+            set
+            {
+                TableName1 = value;
+            }
+        }
+
+        private string value;
+
+        public string Field
+        {
+            get
+            {
+                return Field1;
+            }
+
+            set
+            {
+                Field1 = value;
+            }
+        }
+
+        public string Condition
+        {
+            get
+            {
+                return condition;
+            }
+
+            set
+            {
+                condition = value;
+            }
+        }
+
+        public string ValueField
+        {
+            get
+            {
+                return valueField;
+            }
+
+            set
+            {
+                valueField = value;
+            }
+        }
+
+        public string Value
+        {
+            get
+            {
+                return value;
+            }
+
+            set
+            {
+                this.value = value;
+            }
+        }
+
+        private string valueField;
+
+        private string condition;
+
+        private void TextBox_Leave(object sender, EventArgs e)
+        {
+            Height = EnterTextBox.Height;
+            ListBox.Visible = false;
+        }
+
+        private void BlurSearch_Load(object sender, EventArgs e)
+        {
+            Height = EnterTextBox.Height;
+            ListBox.Visible = false;
+        }
+
+        private void EnterTextBox_TextChanged(object sender, EventArgs e)
+        {
+            if (TableName1 != null && EnterTextBox.Focused)
+            {
+                string con = Field1 + " like '%" + EnterTextBox.Text + "%' and rownum<=5 ";
+                if (condition != "" && condition != null)
+                {
+                    con = Field1 + " like '%" + EnterTextBox.Text + "%' and rownum<=5 and " + condition;
+                }
+                dt = dh.getFieldsDatasByCondition(TableName1, new string[] { Field1, valueField, "rownum" }, con.ToUpper());
+                if (dt.Rows.Count > 0)
+                {
+                    ListBox.Items.Clear();
+                    for (int i = 0; i < dt.Rows.Count; i++)
+                    {
+                        ListBox.Items.Add(dt.Rows[i][Field1]);
+                    }
+                    //每次数据查询之后将索引重置
+                    ItemSelectIndex = 0;
+                    ListBox.Height = ListBox.ItemHeight * (dt.Rows.Count + 1);
+                    ListBox.Visible = true;
+                    Height = ListBox.Height + EnterTextBox.Height;
+                }
+                if (dt.Rows.Count == 1)
+                {
+                    value = dt.Rows[0][valueField].ToString();
+                }
+            }
+            else
+            {
+                ListBox.Visible = false;
+                Height = EnterTextBox.Height;
+            }
+            UserControlTextChanged?.Invoke(sender, new EventArgs());
+        }
+
+        private void ListBox_Click(object sender, EventArgs e)
+        {
+            value = dt.Select("rownum=" + (ListBox.SelectedIndex + 1))[0][1].ToString();
+            EnterTextBox.Text = ListBox.SelectedItem.ToString();
+            ListBox.Visible = false;
+            Height = EnterTextBox.Height;
+        }
+
+        private void EnterTextBox_KeyDown(object sender, KeyEventArgs e)
+        {
+            if (ListBox.Items.Count > 0)
+            {
+                if (e.KeyCode == Keys.Down || e.KeyCode == Keys.Up)
+                {
+                    switch (e.KeyCode)
+                    {
+                        case Keys.Down:
+                            if (ListBox.Items.Count > ItemSelectIndex + 1)
+                                ItemSelectIndex = ItemSelectIndex + 1;
+                            break;
+                        case Keys.Up:
+                            if (ItemSelectIndex - 1 >= 0)
+                                ItemSelectIndex = ItemSelectIndex - 1;
+                            break;
+                        default:
+                            break;
+                    }
+                    ListBox.SelectedIndex = ItemSelectIndex;
+                }
+                if (e.KeyCode == Keys.Enter)
+                {
+                    try
+                    {
+                        EnterTextBox.Text = ListBox.SelectedItem.ToString();
+                        ListBox.Visible = false;
+                        Height = EnterTextBox.Height;
+                    }
+                    catch (Exception)
+                    {
+                    }
+                }
+            }
+            UserKeyDown?.Invoke(sender, e);
+        }
+
+        private void EnterTextBox_Enter(object sender, EventArgs e)
+        {
+            string con = Field1 + " like '%" + EnterTextBox.Text + "%' and rownum<=10 ";
+            if (condition != "" && condition != null)
+            {
+                con = Field1 + " like '%" + EnterTextBox.Text + "%' and rownum<=10 and " + condition;
+            }
+            dt = dh.getFieldsDatasByCondition(TableName1, new string[] { Field1, valueField, "rownum" }, con.ToUpper());
+            if (dt.Rows.Count > 0)
+            {
+                ListBox.Items.Clear();
+                for (int i = 0; i < dt.Rows.Count; i++)
+                {
+                    ListBox.Items.Add(dt.Rows[i][Field1]);
+                }
+                //每次数据查询之后将索引重置
+                ItemSelectIndex = 0;
+                ListBox.Height = ListBox.ItemHeight * (dt.Rows.Count + 1);
+                ListBox.Visible = true;
+                Height = ListBox.Height + EnterTextBox.Height;
+            }
+        }
+
+        private void EnterTextBox_Leave(object sender, EventArgs e)
+        {
+            //ListBox.Visible = false;
+        }
+
+        private void BlurSearch_Leave(object sender, EventArgs e)
+        {
+            ListBox.Height = 0;
+            ListBox.Visible = false;
+            Height = ListBox.Height + EnterTextBox.Height;
+        }
+    }
+}

+ 120 - 0
UAS-出货标签管理/CustomControl/BlurSearch.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-出货标签管理/UAS-出货标签管理.csproj

@@ -127,6 +127,12 @@
     <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="CustomControl\BlurSearch.cs">
+      <SubType>UserControl</SubType>
+    </Compile>
+    <Compile Include="CustomControl\BlurSearch.Designer.cs">
+      <DependentUpon>BlurSearch.cs</DependentUpon>
+    </Compile>
     <Compile Include="CustomControl\ChooseAllButton.cs">
       <SubType>Component</SubType>
     </Compile>
@@ -275,6 +281,9 @@
     <Compile Include="采集策略.Designer.cs">
       <DependentUpon>采集策略.cs</DependentUpon>
     </Compile>
+    <EmbeddedResource Include="CustomControl\BlurSearch.resx">
+      <DependentUpon>BlurSearch.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="CustomControl\DataGridViewWithSerialNum.resx">
       <DependentUpon>DataGridViewWithSerialNum.cs</DependentUpon>
     </EmbeddedResource>

+ 9 - 9
UAS-出货标签管理/UAS_出货标签管理.Designer.cs

@@ -162,7 +162,7 @@
             this.pib_pdno = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pib_prodcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pr_vendprodcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pr_brand = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pib_brand = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pib_madein = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pib_lotno = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pib_datecode = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -1102,7 +1102,7 @@
             this.pib_pdno,
             this.pib_prodcode,
             this.pr_vendprodcode,
-            this.pr_brand,
+            this.pib_brand,
             this.pib_madein,
             this.pib_lotno,
             this.pib_datecode,
@@ -1593,13 +1593,13 @@
             this.pr_vendprodcode.ReadOnly = true;
             this.pr_vendprodcode.Width = 48;
             // 
-            // pr_brand
+            // pib_brand
             // 
-            this.pr_brand.DataPropertyName = "pr_brand";
-            this.pr_brand.HeaderText = "品牌";
-            this.pr_brand.Name = "pr_brand";
-            this.pr_brand.ReadOnly = true;
-            this.pr_brand.Width = 54;
+            this.pib_brand.DataPropertyName = "pib_brand";
+            this.pib_brand.HeaderText = "品牌";
+            this.pib_brand.Name = "pib_brand";
+            this.pib_brand.ReadOnly = true;
+            this.pib_brand.Width = 54;
             // 
             // pib_madein
             // 
@@ -1914,7 +1914,7 @@
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_pdno;
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_prodcode;
         private System.Windows.Forms.DataGridViewTextBoxColumn pr_vendprodcode;
-        private System.Windows.Forms.DataGridViewTextBoxColumn pr_brand;
+        private System.Windows.Forms.DataGridViewTextBoxColumn pib_brand;
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_madein;
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_lotno;
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_datecode;

+ 41 - 4
UAS-出货标签管理/UAS_出货标签管理.cs

@@ -798,6 +798,31 @@ namespace UAS_LabelMachine
                             setdata.Remove("QTY");
                             length--;
                             break;
+                        case "品牌":
+                            cell = LabelInf.Rows[CurrentRowIndex].Cells["pib_brand"];
+                            Matchstr = MatchStr(data[j], "品牌");
+                            //如果采集的数量不相等的话
+                            if (cell.Value.ToString() != Matchstr)
+                            {
+                                CollectQTYPass = false;
+                                //添加需要重绘的Cell
+                                if (PaintCell.ContainsKey(cell))
+                                    PaintCell.Remove(cell);
+                                PaintCell.Add(cell, false);
+                                LabelInf.Refresh();
+                                MessageLog.AppendText(">>品牌不匹配\n", Color.Red);
+                            }
+                            else
+                            {
+                                if (PaintCell.ContainsKey(cell))
+                                    PaintCell.Remove(cell);
+                                PaintCell.Add(cell, true);
+                                LabelInf.Refresh();
+                                CollectQTYPass = true;
+                            }
+                            setdata.Remove("品牌");
+                            length--;
+                            break;
                         default:
                             break;
                     }
@@ -806,7 +831,7 @@ namespace UAS_LabelMachine
                     if (cell.Value.ToString() == "" || cell.Value.ToString() != Matchstr)
                     {
                         string MatchResult = "";
-                        if (kind != "MPN" && kind != "QTY")
+                        if (kind != "MPN" && kind != "QTY" && kind != "品牌")
                         {
                             DataTable dt = (DataTable)MidSource.DataSource;
                             cell.Value = Matchstr;
@@ -2039,12 +2064,13 @@ namespace UAS_LabelMachine
             else
             {
                 sql.Clear();
-                sql.Append("select pd_custprodcode,pd_custprodspec,pd_pocode,pib_madein,pib_custbarcode,pib_id,pib_datecode1,pib_pdid,pib_piid,pib_pdno,pib_prodcode,pr_brand,pr_vendprodcode,");
+                sql.Append("select pd_custprodcode,pd_custprodspec,pd_pocode,pib_madein,pib_custbarcode,pib_id,pib_datecode1,pib_pdid,pib_piid,pib_pdno,pib_prodcode,pr_brand,nvl(nvl(pd_brand,pib_brand),pr_brand)pib_brand, pr_vendprodcode,");
                 sql.Append("pib_lotno,pib_datecode,pib_qty,pib_barcode,pib_outboxcode1,pib_outboxcode2,nvl(pib_ifpick,0)pib_ifpick,nvl(pib_ifprint,0)pib_ifprint");
                 sql.Append(",sa_pocode from prodiobarcode left join prodiodetail on pib_piid=pd_piid and pd_pdno=pib_pdno and ");
                 sql.Append(" pd_prodcode=pib_prodcode left join product on pr_code=pib_prodcode left join sale on sa_code=pib_ordercode ");
                 sql.Append("where pib_piid='" + PI_ID + "' order by to_number(pib_outboxcode1),pib_id,pd_prodcode");
             }
+            Console.WriteLine(sql.ToString());
             dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
             MidSource.DataSource = dt;
             BaseUtil.FillDgvWithDataTable(LabelInf, (DataTable)MidSource.DataSource);
@@ -2052,7 +2078,7 @@ namespace UAS_LabelMachine
             TotalCount.Text = LabelInf.RowCount.ToString();
             if (LabelInf.RowCount > 0)
             {
-                Brand = LabelInf.Rows[0].Cells["pr_brand"].FormattedValue.ToString();
+                Brand = LabelInf.Rows[0].Cells["pib_brand"].FormattedValue.ToString();
                 if (Brand != "")
                     sg_code.Text = dh.getFieldDataByCondition("scangroup", "sg_code", "sg_brand='" + Brand + "'").ToString();
                 SetOutBoxCapacity(LabelInf.Rows[0].Cells["pib_prodcode"].Value.ToString());
@@ -2081,7 +2107,7 @@ namespace UAS_LabelMachine
             bool mouseOver = e.CellBounds.Contains(this.PointToClient(Cursor.Position));
             if (e.ColumnIndex > 0)
             {
-                if (LabelInf.Columns[e.ColumnIndex].Name == "pib_madein" || LabelInf.Columns[e.ColumnIndex].Name == "pib_lotno" || LabelInf.Columns[e.ColumnIndex].Name == "pib_datecode" || LabelInf.Columns[e.ColumnIndex].Name == "pib_outboxcode1" || LabelInf.Columns[e.ColumnIndex].Name == "pib_outboxcode2")
+                if (LabelInf.Columns[e.ColumnIndex].Name == "pib_madein" || LabelInf.Columns[e.ColumnIndex].Name == "pib_lotno" || LabelInf.Columns[e.ColumnIndex].Name == "pib_datecode" || LabelInf.Columns[e.ColumnIndex].Name == "pib_outboxcode1" || LabelInf.Columns[e.ColumnIndex].Name == "pib_outboxcode2" || LabelInf.Columns[e.ColumnIndex].Name == "pib_brand")
                 {
                     SolidBrush solidBrush = new SolidBrush(Color.FromArgb(51, 153, 255));
                     e.Graphics.FillRectangle(mouseOver ? solidBrush : Brushes.LightSeaGreen, e.CellBounds);
@@ -2115,6 +2141,17 @@ namespace UAS_LabelMachine
                         e.PaintContent(e.CellBounds);
                         e.Handled = true;
                     }
+                    //表示采集的供应商物料编号不匹配
+                    if (LabelInf.Columns[e.ColumnIndex].Name == "pib_brand" && PaintCell.ContainsKey(LabelInf.Rows[e.RowIndex].Cells["pib_brand"]))
+                    {
+                        SolidBrush solidBrush = new SolidBrush(Color.FromArgb(51, 153, 255));
+                        e.Graphics.FillRectangle(PaintCell[LabelInf.Rows[e.RowIndex].Cells["pib_brand"]] ? Brushes.ForestGreen : Brushes.Red, e.CellBounds);
+                        Rectangle border = e.CellBounds;
+                        border.Width -= 1;
+                        e.Graphics.DrawRectangle(Pens.Black, border);
+                        e.PaintContent(e.CellBounds);
+                        e.Handled = true;
+                    }
                 }
             }
         }

+ 263 - 1
UAS-出货标签管理/采集策略.Designer.cs

@@ -113,6 +113,24 @@
             this.si_expressionitem3_label = new System.Windows.Forms.Label();
             this.si_expressionitem1_label = new System.Windows.Forms.Label();
             this.si_expressionitem2_label = new System.Windows.Forms.Label();
+            this.si_expressionitem5_label = new System.Windows.Forms.Label();
+            this.si_expressionitem5 = new UAS_LabelMachine.CustomControl.EnterTextBox();
+            this.si_id5 = new UAS_LabelMachine.CustomControl.EnterTextBox();
+            this.si_indexstring5 = new UAS_LabelMachine.CustomControl.EnterTextBox();
+            this.si_indexstring5_label = new System.Windows.Forms.Label();
+            this.si_length5 = new UAS_LabelMachine.CustomControl.NumOnlyTextBox();
+            this.si_length5_label = new System.Windows.Forms.Label();
+            this.si_index5 = new UAS_LabelMachine.CustomControl.NumOnlyTextBox();
+            this.si_index5_label = new System.Windows.Forms.Label();
+            this.si_kind5 = new System.Windows.Forms.ComboBox();
+            this.si_item5 = new UAS_LabelMachine.CustomControl.EnterTextBox();
+            this.label5 = new System.Windows.Forms.Label();
+            this.si_detno5 = new UAS_LabelMachine.CustomControl.EnterTextBox();
+            this.si_detno5_label = new System.Windows.Forms.Label();
+            this.si_kind5_label = new System.Windows.Forms.Label();
+            this.si_expression5 = new UAS_LabelMachine.CustomControl.EnterTextBox();
+            this.si_expression5_label = new System.Windows.Forms.Label();
+            this.si_type5 = new System.Windows.Forms.CheckBox();
             this.SuspendLayout();
             // 
             // sg_name_label
@@ -1089,11 +1107,237 @@
             this.si_expressionitem2_label.TabIndex = 119;
             this.si_expressionitem2_label.Text = "项次";
             // 
+            // si_expressionitem5_label
+            // 
+            this.si_expressionitem5_label.AutoSize = true;
+            this.si_expressionitem5_label.BackColor = System.Drawing.Color.Transparent;
+            this.si_expressionitem5_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.si_expressionitem5_label.Location = new System.Drawing.Point(783, 558);
+            this.si_expressionitem5_label.Name = "si_expressionitem5_label";
+            this.si_expressionitem5_label.Size = new System.Drawing.Size(42, 21);
+            this.si_expressionitem5_label.TabIndex = 137;
+            this.si_expressionitem5_label.Text = "项次";
+            // 
+            // si_expressionitem5
+            // 
+            this.si_expressionitem5.Enabled = false;
+            this.si_expressionitem5.ID = null;
+            this.si_expressionitem5.Location = new System.Drawing.Point(831, 558);
+            this.si_expressionitem5.Name = "si_expressionitem5";
+            this.si_expressionitem5.Size = new System.Drawing.Size(157, 21);
+            this.si_expressionitem5.Str = null;
+            this.si_expressionitem5.Str1 = null;
+            this.si_expressionitem5.Str2 = null;
+            this.si_expressionitem5.TabIndex = 136;
+            // 
+            // si_id5
+            // 
+            this.si_id5.Enabled = false;
+            this.si_id5.ID = null;
+            this.si_id5.Location = new System.Drawing.Point(914, 594);
+            this.si_id5.Name = "si_id5";
+            this.si_id5.Size = new System.Drawing.Size(157, 21);
+            this.si_id5.Str = null;
+            this.si_id5.Str1 = null;
+            this.si_id5.Str2 = null;
+            this.si_id5.TabIndex = 135;
+            this.si_id5.Visible = false;
+            // 
+            // si_indexstring5
+            // 
+            this.si_indexstring5.Enabled = false;
+            this.si_indexstring5.ID = null;
+            this.si_indexstring5.Location = new System.Drawing.Point(355, 594);
+            this.si_indexstring5.Name = "si_indexstring5";
+            this.si_indexstring5.Size = new System.Drawing.Size(157, 21);
+            this.si_indexstring5.Str = null;
+            this.si_indexstring5.Str1 = null;
+            this.si_indexstring5.Str2 = null;
+            this.si_indexstring5.TabIndex = 134;
+            // 
+            // si_indexstring5_label
+            // 
+            this.si_indexstring5_label.AutoSize = true;
+            this.si_indexstring5_label.BackColor = System.Drawing.Color.Transparent;
+            this.si_indexstring5_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.si_indexstring5_label.Location = new System.Drawing.Point(268, 594);
+            this.si_indexstring5_label.Name = "si_indexstring5_label";
+            this.si_indexstring5_label.Size = new System.Drawing.Size(74, 21);
+            this.si_indexstring5_label.TabIndex = 133;
+            this.si_indexstring5_label.Text = "索引字符";
+            // 
+            // si_length5
+            // 
+            this.si_length5.Enabled = false;
+            this.si_length5.Location = new System.Drawing.Point(616, 594);
+            this.si_length5.Name = "si_length5";
+            this.si_length5.Negative = false;
+            this.si_length5.Size = new System.Drawing.Size(157, 21);
+            this.si_length5.TabIndex = 132;
+            // 
+            // si_length5_label
+            // 
+            this.si_length5_label.AutoSize = true;
+            this.si_length5_label.BackColor = System.Drawing.Color.Transparent;
+            this.si_length5_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.si_length5_label.Location = new System.Drawing.Point(518, 594);
+            this.si_length5_label.Name = "si_length5_label";
+            this.si_length5_label.Size = new System.Drawing.Size(42, 21);
+            this.si_length5_label.TabIndex = 131;
+            this.si_length5_label.Text = "长度";
+            // 
+            // si_index5
+            // 
+            this.si_index5.Enabled = false;
+            this.si_index5.Location = new System.Drawing.Point(100, 594);
+            this.si_index5.Name = "si_index5";
+            this.si_index5.Negative = false;
+            this.si_index5.Size = new System.Drawing.Size(157, 21);
+            this.si_index5.TabIndex = 130;
+            // 
+            // si_index5_label
+            // 
+            this.si_index5_label.AutoSize = true;
+            this.si_index5_label.BackColor = System.Drawing.Color.Transparent;
+            this.si_index5_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.si_index5_label.Location = new System.Drawing.Point(20, 594);
+            this.si_index5_label.Name = "si_index5_label";
+            this.si_index5_label.Size = new System.Drawing.Size(74, 21);
+            this.si_index5_label.TabIndex = 129;
+            this.si_index5_label.Text = "起始位置";
+            // 
+            // si_kind5
+            // 
+            this.si_kind5.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+            this.si_kind5.Enabled = false;
+            this.si_kind5.FormattingEnabled = true;
+            this.si_kind5.Items.AddRange(new object[] {
+            "起始位置",
+            "索引字符",
+            "二次解析",
+            "全部"});
+            this.si_kind5.Location = new System.Drawing.Point(355, 558);
+            this.si_kind5.Name = "si_kind5";
+            this.si_kind5.Size = new System.Drawing.Size(157, 20);
+            this.si_kind5.TabIndex = 128;
+            // 
+            // si_item5
+            // 
+            this.si_item5.Enabled = false;
+            this.si_item5.ID = null;
+            this.si_item5.Location = new System.Drawing.Point(914, 554);
+            this.si_item5.Name = "si_item5";
+            this.si_item5.Size = new System.Drawing.Size(157, 21);
+            this.si_item5.Str = null;
+            this.si_item5.Str1 = null;
+            this.si_item5.Str2 = null;
+            this.si_item5.TabIndex = 127;
+            this.si_item5.Text = "QTY";
+            this.si_item5.Visible = false;
+            // 
+            // label5
+            // 
+            this.label5.AutoSize = true;
+            this.label5.BackColor = System.Drawing.Color.Transparent;
+            this.label5.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label5.Location = new System.Drawing.Point(835, 554);
+            this.label5.Name = "label5";
+            this.label5.Size = new System.Drawing.Size(74, 21);
+            this.label5.TabIndex = 126;
+            this.label5.Text = "字段名称";
+            this.label5.Visible = false;
+            // 
+            // si_detno5
+            // 
+            this.si_detno5.Enabled = false;
+            this.si_detno5.ID = null;
+            this.si_detno5.Location = new System.Drawing.Point(100, 558);
+            this.si_detno5.Name = "si_detno5";
+            this.si_detno5.Size = new System.Drawing.Size(157, 21);
+            this.si_detno5.Str = null;
+            this.si_detno5.Str1 = null;
+            this.si_detno5.Str2 = null;
+            this.si_detno5.TabIndex = 125;
+            // 
+            // si_detno5_label
+            // 
+            this.si_detno5_label.AutoSize = true;
+            this.si_detno5_label.BackColor = System.Drawing.Color.Transparent;
+            this.si_detno5_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.si_detno5_label.Location = new System.Drawing.Point(20, 558);
+            this.si_detno5_label.Name = "si_detno5_label";
+            this.si_detno5_label.Size = new System.Drawing.Size(74, 21);
+            this.si_detno5_label.TabIndex = 124;
+            this.si_detno5_label.Text = "扫描次序";
+            // 
+            // si_kind5_label
+            // 
+            this.si_kind5_label.AutoSize = true;
+            this.si_kind5_label.BackColor = System.Drawing.Color.Transparent;
+            this.si_kind5_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.si_kind5_label.Location = new System.Drawing.Point(268, 558);
+            this.si_kind5_label.Name = "si_kind5_label";
+            this.si_kind5_label.Size = new System.Drawing.Size(74, 21);
+            this.si_kind5_label.TabIndex = 123;
+            this.si_kind5_label.Text = "解析方式";
+            // 
+            // si_expression5
+            // 
+            this.si_expression5.Enabled = false;
+            this.si_expression5.ID = null;
+            this.si_expression5.Location = new System.Drawing.Point(616, 558);
+            this.si_expression5.Name = "si_expression5";
+            this.si_expression5.Size = new System.Drawing.Size(157, 21);
+            this.si_expression5.Str = null;
+            this.si_expression5.Str1 = null;
+            this.si_expression5.Str2 = null;
+            this.si_expression5.TabIndex = 122;
+            // 
+            // si_expression5_label
+            // 
+            this.si_expression5_label.AutoSize = true;
+            this.si_expression5_label.BackColor = System.Drawing.Color.Transparent;
+            this.si_expression5_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.si_expression5_label.Location = new System.Drawing.Point(518, 558);
+            this.si_expression5_label.Name = "si_expression5_label";
+            this.si_expression5_label.Size = new System.Drawing.Size(90, 21);
+            this.si_expression5_label.TabIndex = 121;
+            this.si_expression5_label.Text = "正则表达式";
+            // 
+            // si_type5
+            // 
+            this.si_type5.AutoSize = true;
+            this.si_type5.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.si_type5.Location = new System.Drawing.Point(24, 521);
+            this.si_type5.Name = "si_type5";
+            this.si_type5.Size = new System.Drawing.Size(61, 25);
+            this.si_type5.TabIndex = 120;
+            this.si_type5.Text = "品牌";
+            this.si_type5.UseVisualStyleBackColor = true;
+            // 
             // 采集策略
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(1082, 576);
+            this.ClientSize = new System.Drawing.Size(1082, 634);
+            this.Controls.Add(this.si_expressionitem5_label);
+            this.Controls.Add(this.si_expressionitem5);
+            this.Controls.Add(this.si_id5);
+            this.Controls.Add(this.si_indexstring5);
+            this.Controls.Add(this.si_indexstring5_label);
+            this.Controls.Add(this.si_length5);
+            this.Controls.Add(this.si_length5_label);
+            this.Controls.Add(this.si_index5);
+            this.Controls.Add(this.si_index5_label);
+            this.Controls.Add(this.si_kind5);
+            this.Controls.Add(this.si_item5);
+            this.Controls.Add(this.label5);
+            this.Controls.Add(this.si_detno5);
+            this.Controls.Add(this.si_detno5_label);
+            this.Controls.Add(this.si_kind5_label);
+            this.Controls.Add(this.si_expression5);
+            this.Controls.Add(this.si_expression5_label);
+            this.Controls.Add(this.si_type5);
             this.Controls.Add(this.si_expressionitem2_label);
             this.Controls.Add(this.si_expressionitem1_label);
             this.Controls.Add(this.si_expressionitem3_label);
@@ -1273,5 +1517,23 @@
         private System.Windows.Forms.Label si_expressionitem3_label;
         private System.Windows.Forms.Label si_expressionitem1_label;
         private System.Windows.Forms.Label si_expressionitem2_label;
+        private System.Windows.Forms.Label si_expressionitem5_label;
+        private CustomControl.EnterTextBox si_expressionitem5;
+        private CustomControl.EnterTextBox si_id5;
+        private CustomControl.EnterTextBox si_indexstring5;
+        private System.Windows.Forms.Label si_indexstring5_label;
+        private CustomControl.NumOnlyTextBox si_length5;
+        private System.Windows.Forms.Label si_length5_label;
+        private CustomControl.NumOnlyTextBox si_index5;
+        private System.Windows.Forms.Label si_index5_label;
+        private System.Windows.Forms.ComboBox si_kind5;
+        private CustomControl.EnterTextBox si_item5;
+        private System.Windows.Forms.Label label5;
+        private CustomControl.EnterTextBox si_detno5;
+        private System.Windows.Forms.Label si_detno5_label;
+        private System.Windows.Forms.Label si_kind5_label;
+        private CustomControl.EnterTextBox si_expression5;
+        private System.Windows.Forms.Label si_expression5_label;
+        private System.Windows.Forms.CheckBox si_type5;
     }
 }

+ 10 - 4
UAS-出货标签管理/采集策略.cs

@@ -24,6 +24,7 @@ namespace UAS_LabelMachine
             si_type3.CheckedChanged += CheckChanged;
             si_type4.CheckedChanged += CheckChanged;
             si_type2.CheckedChanged += CheckChanged;
+            si_type5.CheckedChanged += CheckChanged;
         }
 
         public 采集策略(string SG_CODE)
@@ -34,6 +35,7 @@ namespace UAS_LabelMachine
             si_type3.CheckedChanged += CheckChanged;
             si_type4.CheckedChanged += CheckChanged;
             si_type2.CheckedChanged += CheckChanged;
+            si_type5.CheckedChanged += CheckChanged;
         }
 
         private void 采集策略_Load(object sender, EventArgs e)
@@ -48,6 +50,7 @@ namespace UAS_LabelMachine
             si_kind2.Text = "全部";
             si_kind3.Text = "全部";
             si_kind4.Text = "全部";
+            si_kind5.Text = "全部";
             if (sg_code.Text != "")
             {
                 KeyEventArgs e2 = new KeyEventArgs(Keys.Enter);
@@ -74,7 +77,7 @@ namespace UAS_LabelMachine
                 sql.Append("update scangroup set sg_name='" + sg_name.Text + "',sg_code='" + sg_code.Text + "',sg_brand='" + pb_name.Text + "',");
                 sql.Append("sg_separator=:sg_separator where sg_id=" + sg_id.Text);
                 dh.ExecuteSql(sql.ToString(), "update", new string[] { sg_separator.Text });
-                for (int i = 1; i < 5; i++)
+                for (int i = 1; i < 6; i++)
                 {
                     //如果从表的ID不为空则表示此条记录已存在需要更新
                     if (Controls["si_id" + i].Text != "")
@@ -106,7 +109,7 @@ namespace UAS_LabelMachine
                     sql.Append("'" + pb_name.Text + "',:sg_separator)");
                     dh.ExecuteSql(sql.ToString(), "insert", new string[] { sg_separator.Text });
                     //遍历需要采集的字段
-                    for (int i = 1; i < 5; i++)
+                    for (int i = 1; i < 6; i++)
                     {
                         //保存四条记录,通过si_enable字段来判断是否启用
                         int Enable = 0;
@@ -167,6 +170,9 @@ namespace UAS_LabelMachine
                 case "MPN":
                     i = 4;
                     break;
+                case "品牌":
+                    i = 5;
+                    break;
                 default:
                     break;
             }
@@ -207,7 +213,7 @@ namespace UAS_LabelMachine
                     //通过匹配采集的字段名称给界面赋值
                     for (int i = 0; i < dt.Rows.Count; i++)
                     {
-                        for (int j = 1; j < 5; j++)
+                        for (int j = 1; j < 6; j++)
                         {
                             //如果Item和CheckBox的文字相等
                             if (dt.Rows[i]["si_item"].ToString() == Controls["si_type" + j].Text)
@@ -244,7 +250,7 @@ namespace UAS_LabelMachine
         private void Add_Click(object sender, EventArgs e)
         {
             BaseUtil.CleanForm(this);
-            for (int i = 1; i < 5; i++)
+            for (int i = 1; i < 6; i++)
                 (Controls["si_type" + i] as CheckBox).Checked = false;
         }
     }