Browse Source

修改选择客户出现重复条件的BUG

章政 7 years ago
parent
commit
93ac30b37a

+ 0 - 1
UAS-出货标签管理/CustomControl/Pagination.cs

@@ -61,7 +61,6 @@ namespace UAS_LabelMachine.CustomControl
             //当前在多少页
             Current_Page = int.Parse(this.CurrentPage.Text);
             //获取记录的总行数
-            Console.WriteLine(TableName);
             RowCount = dh.getRowCount(TableName);
             //分页获取数据,先取第一页的
             dt = dh.getFieldsDatasByPageing(TableName, field, Current_Page, PageSize, Caller, condition);

+ 6 - 1
UAS-出货标签管理/DbFind.cs

@@ -77,6 +77,10 @@ namespace UAS_LabelMachine
             {
                 //先绑定空的结构
                 DbFindGridView.DataSource = dt;
+                for (int i = 0; i < DbFindGridView.Columns.Count; i++)
+                {
+                    DbFindGridView.Columns[i].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
+                }
                 //获取查询的字段的拼接语句
                 pagination1.BindDataToNavigator(DbFindGridView, tablename, SelectField, "ID", caller, Condition == null ? "" : Condition);
                 IsAbleDbFind = true;
@@ -175,7 +179,8 @@ namespace UAS_LabelMachine
         //列宽发生变化的时候TextBox的宽度也发生变化
         private void DbFindGridView_ColumnWidthChanged(object sender, DataGridViewColumnEventArgs e)
         {
-            ctl[DbFindGridView.Columns.IndexOf(e.Column)].Width = e.Column.Width;
+            if (ctl != null)
+                ctl[DbFindGridView.Columns.IndexOf(e.Column)].Width = e.Column.Width;
         }
     }
 }

+ 24 - 37
UAS-出货标签管理/Login.Designer.cs

@@ -50,10 +50,9 @@
             // 
             this.pictureBox1.BackColor = System.Drawing.Color.Transparent;
             this.pictureBox1.Image = global::UAS_LabelMachine.Properties.Resources.users_user_72px_523311_easyicon_net;
-            this.pictureBox1.Location = new System.Drawing.Point(312, 226);
-            this.pictureBox1.Margin = new System.Windows.Forms.Padding(4);
+            this.pictureBox1.Location = new System.Drawing.Point(234, 181);
             this.pictureBox1.Name = "pictureBox1";
-            this.pictureBox1.Size = new System.Drawing.Size(96, 90);
+            this.pictureBox1.Size = new System.Drawing.Size(72, 72);
             this.pictureBox1.TabIndex = 0;
             this.pictureBox1.TabStop = false;
             // 
@@ -63,30 +62,27 @@
             this.label1.BackColor = System.Drawing.Color.Transparent;
             this.label1.Font = new System.Drawing.Font("微软雅黑", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.label1.ForeColor = System.Drawing.SystemColors.Desktop;
-            this.label1.Location = new System.Drawing.Point(456, 156);
-            this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.label1.Location = new System.Drawing.Point(342, 125);
             this.label1.Name = "label1";
-            this.label1.Size = new System.Drawing.Size(297, 35);
+            this.label1.Size = new System.Drawing.Size(231, 28);
             this.label1.TabIndex = 1;
             this.label1.Text = "优软-出货标签管理系统";
             // 
             // UserName
             // 
             this.UserName.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.UserName.Location = new System.Drawing.Point(492, 210);
-            this.UserName.Margin = new System.Windows.Forms.Padding(4);
+            this.UserName.Location = new System.Drawing.Point(369, 168);
             this.UserName.Name = "UserName";
-            this.UserName.Size = new System.Drawing.Size(260, 34);
+            this.UserName.Size = new System.Drawing.Size(196, 29);
             this.UserName.TabIndex = 2;
             // 
             // PassWord
             // 
             this.PassWord.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.PassWord.Location = new System.Drawing.Point(492, 258);
-            this.PassWord.Margin = new System.Windows.Forms.Padding(4);
+            this.PassWord.Location = new System.Drawing.Point(369, 206);
             this.PassWord.Name = "PassWord";
             this.PassWord.PasswordChar = '*';
-            this.PassWord.Size = new System.Drawing.Size(260, 34);
+            this.PassWord.Size = new System.Drawing.Size(196, 29);
             this.PassWord.TabIndex = 3;
             this.PassWord.KeyDown += new System.Windows.Forms.KeyEventHandler(this.PassWord_KeyDown);
             // 
@@ -95,10 +91,9 @@
             this.LoginIcon.BackColor = System.Drawing.Color.Transparent;
             this.LoginIcon.Cursor = System.Windows.Forms.Cursors.Hand;
             this.LoginIcon.Image = global::UAS_LabelMachine.Properties.Resources.Login_Icon;
-            this.LoginIcon.Location = new System.Drawing.Point(564, 404);
-            this.LoginIcon.Margin = new System.Windows.Forms.Padding(4);
+            this.LoginIcon.Location = new System.Drawing.Point(423, 323);
             this.LoginIcon.Name = "LoginIcon";
-            this.LoginIcon.Size = new System.Drawing.Size(96, 32);
+            this.LoginIcon.Size = new System.Drawing.Size(72, 26);
             this.LoginIcon.TabIndex = 4;
             this.LoginIcon.TabStop = false;
             this.LoginIcon.Click += new System.EventHandler(this.LoginIcon_Click);
@@ -108,10 +103,9 @@
             this.label2.AutoSize = true;
             this.label2.BackColor = System.Drawing.Color.Transparent;
             this.label2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label2.Location = new System.Drawing.Point(428, 214);
-            this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.label2.Location = new System.Drawing.Point(321, 171);
             this.label2.Name = "label2";
-            this.label2.Size = new System.Drawing.Size(52, 27);
+            this.label2.Size = new System.Drawing.Size(42, 21);
             this.label2.TabIndex = 5;
             this.label2.Text = "账号";
             // 
@@ -120,10 +114,9 @@
             this.label3.AutoSize = true;
             this.label3.BackColor = System.Drawing.Color.Transparent;
             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(432, 261);
-            this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.label3.Location = new System.Drawing.Point(324, 209);
             this.label3.Name = "label3";
-            this.label3.Size = new System.Drawing.Size(52, 27);
+            this.label3.Size = new System.Drawing.Size(42, 21);
             this.label3.TabIndex = 6;
             this.label3.Text = "密码";
             // 
@@ -132,10 +125,9 @@
             this.MasterCombox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
             this.MasterCombox.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.MasterCombox.FormattingEnabled = true;
-            this.MasterCombox.Location = new System.Drawing.Point(492, 309);
-            this.MasterCombox.Margin = new System.Windows.Forms.Padding(4);
+            this.MasterCombox.Location = new System.Drawing.Point(369, 247);
             this.MasterCombox.Name = "MasterCombox";
-            this.MasterCombox.Size = new System.Drawing.Size(260, 35);
+            this.MasterCombox.Size = new System.Drawing.Size(196, 29);
             this.MasterCombox.TabIndex = 7;
             // 
             // Master
@@ -143,10 +135,9 @@
             this.Master.AutoSize = true;
             this.Master.BackColor = System.Drawing.Color.Transparent;
             this.Master.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.Master.Location = new System.Drawing.Point(432, 312);
-            this.Master.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.Master.Location = new System.Drawing.Point(324, 250);
             this.Master.Name = "Master";
-            this.Master.Size = new System.Drawing.Size(52, 27);
+            this.Master.Size = new System.Drawing.Size(42, 21);
             this.Master.TabIndex = 8;
             this.Master.Text = "账套";
             // 
@@ -155,29 +146,26 @@
             this.label4.AutoSize = true;
             this.label4.BackColor = System.Drawing.Color.Transparent;
             this.label4.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label4.Location = new System.Drawing.Point(432, 360);
-            this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.label4.Location = new System.Drawing.Point(324, 288);
             this.label4.Name = "label4";
-            this.label4.Size = new System.Drawing.Size(30, 27);
+            this.label4.Size = new System.Drawing.Size(25, 21);
             this.label4.TabIndex = 10;
             this.label4.Text = "IP";
             // 
             // IP
             // 
             this.IP.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.IP.Location = new System.Drawing.Point(492, 356);
-            this.IP.Margin = new System.Windows.Forms.Padding(4);
+            this.IP.Location = new System.Drawing.Point(369, 285);
             this.IP.Name = "IP";
-            this.IP.Size = new System.Drawing.Size(260, 34);
+            this.IP.Size = new System.Drawing.Size(196, 29);
             this.IP.TabIndex = 9;
-            this.IP.KeyDown += new System.Windows.Forms.KeyEventHandler(this.IP_KeyDown);
             // 
             // Login
             // 
-            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.BackgroundImage = global::UAS_LabelMachine.Properties.Resources.timg;
-            this.ClientSize = new System.Drawing.Size(1179, 576);
+            this.ClientSize = new System.Drawing.Size(884, 461);
             this.Controls.Add(this.label4);
             this.Controls.Add(this.IP);
             this.Controls.Add(this.Master);
@@ -190,7 +178,6 @@
             this.Controls.Add(this.label1);
             this.Controls.Add(this.pictureBox1);
             this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
-            this.Margin = new System.Windows.Forms.Padding(4);
             this.Name = "Login";
             this.Text = "出货标签管理系统";
             this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Login_FormClosing);

+ 3 - 8
UAS-出货标签管理/Login.cs

@@ -3,6 +3,7 @@ using System.Data;
 using System.Drawing;
 using System.Drawing.Drawing2D;
 using System.IO;
+using System.Text;
 using System.Windows.Forms;
 using UAS_LabelMachine.Entity;
 
@@ -29,7 +30,7 @@ namespace UAS_LabelMachine
         {
             dh = new DataHelper();
             //获取账套信息
-            dt = (DataTable)dh.ExecuteSql("select ma_function,ms_pwd,ma_user from datacenter.master where ma_enable<>0", "select");
+            dt = (DataTable)dh.ExecuteSql("select ma_function,ms_pwd,ma_user from datacenter.master ", "select");
             MasterCombox.DisplayMember = "ma_function";
             MasterCombox.ValueMember = "ma_user";
             MasterCombox.DataSource = dt;
@@ -113,11 +114,5 @@ namespace UAS_LabelMachine
         {
             Application.Exit();
         }
-
-        private void IP_KeyDown(object sender, KeyEventArgs e)
-        {
-            if (e.KeyCode == Keys.Enter)
-                DataHelper.DBConnectionString = "Data Source=" + IP.Text + "/orcl;User ID=DATACENTER;PassWord=select!#%*(";
-        }
     }
-}
+}

+ 0 - 1
UAS-出货标签管理/Program.cs

@@ -66,7 +66,6 @@ namespace UAS_LabelMachine
         //未处理的异常统一通过这里返回
         static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
         {
-            Console.WriteLine("异常");
             string str = GetExceptionMsg(e.ExceptionObject as Exception, e.ToString());
             MessageBox.Show(str, "操作异常", MessageBoxButtons.OK, MessageBoxIcon.Stop);
         }

+ 221 - 12
UAS-出货标签管理/PublicMethod/BaseUtil.cs

@@ -3,11 +3,12 @@ using System.Collections;
 using System.Collections.Generic;
 using System.Data;
 using System.Text;
-using System.Text.RegularExpressions;
 using System.Windows.Forms;
 using UAS_LabelMachine.CustomControl;
 using UAS_LabelMachine.CustomControl.GroupBoxWithBorder;
+using System.Security.Cryptography;
 using static System.Windows.Forms.Control;
+using System.IO;
 
 namespace UAS_LabelMachine
 {
@@ -16,6 +17,8 @@ namespace UAS_LabelMachine
 
         static string SysDisc;
 
+        private string Key = "96878265";
+
         public static string SysDisc1
         {
             get
@@ -29,6 +32,213 @@ namespace UAS_LabelMachine
             }
         }
 
+        public static byte[] hexStr2ByteArr(string strIn)
+        {
+            byte[] arrB = Encoding.UTF8.GetBytes(strIn);
+            int iLen = arrB.Length;
+            // 两个字符表示一个字节,所以字节数组长度是字符串长度除以2   
+            byte[] arrOut = new byte[iLen / 2];
+            for (int i = 0; i < iLen; i = i + 2)
+            {
+                string strTmp = new string(Encoding.UTF8.GetChars(arrB), i, 2);
+                arrOut[i / 2] = (byte)int.Parse(strTmp, System.Globalization.NumberStyles.HexNumber);
+            }
+            return arrOut;
+        }
+
+        public byte[] decrypt(byte[] arrB)
+        {
+            return null;
+            //return decryptCipher.doFinal(arrB);
+        }
+
+        public string decrypt(string strIn)
+        {
+            return new string(Encoding.ASCII.GetChars(decrypt(hexStr2ByteArr(strIn))));
+        }
+
+        public static string DESEnCode(string pToEncrypt, string sKey)
+        {
+            // string pToEncrypt1 = HttpContext.Current.Server.UrlEncode(pToEncrypt);   
+            DESCryptoServiceProvider des = new DESCryptoServiceProvider();
+            byte[] inputByteArray = Encoding.GetEncoding("UTF-8").GetBytes(pToEncrypt);
+
+            //建立加密对象的密钥和偏移量    
+            //原文使用ASCIIEncoding.ASCII方法的GetBytes方法    
+            //使得输入密码必须输入英文文本    
+            des.Key = Encoding.UTF8.GetBytes(sKey);
+            des.IV = Encoding.UTF8.GetBytes(sKey);
+            MemoryStream ms = new MemoryStream();
+            CryptoStream cs = new CryptoStream(ms, des.CreateEncryptor(), CryptoStreamMode.Write);
+
+            cs.Write(inputByteArray, 0, inputByteArray.Length);
+            cs.FlushFinalBlock();
+
+            StringBuilder ret = new StringBuilder();
+            foreach (byte b in ms.ToArray())
+            {
+                ret.AppendFormat("{0:X2}", b);
+            }
+            ret.ToString();
+            return ret.ToString();
+        }
+
+        public static string DESDeCode(string pToDecrypt, string sKey)
+        {
+            DESCryptoServiceProvider des = new DESCryptoServiceProvider();
+
+            byte[] inputByteArray = new byte[pToDecrypt.Length / 2];
+            for (int x = 0; x < pToDecrypt.Length / 2; x++)
+            {
+                int i = (Convert.ToInt32(pToDecrypt.Substring(x * 2, 2), 16));
+                inputByteArray[x] = (byte)i;
+            }
+            des.Key = Encoding.UTF8.GetBytes(sKey);
+            des.IV = Encoding.UTF8.GetBytes(sKey);
+            MemoryStream ms = new MemoryStream();
+            CryptoStream cs = new CryptoStream(ms, des.CreateDecryptor(), CryptoStreamMode.Write);
+            cs.Write(inputByteArray, 0, inputByteArray.Length);
+            cs.FlushFinalBlock();
+
+            return Encoding.UTF8.GetString(ms.ToArray());
+        }
+
+        public static byte[] Des3EncodeCBC(byte[] key, byte[] iv, byte[] data)
+        {
+            //复制于MSDN  
+            try
+            {
+                // Create a MemoryStream.  
+                MemoryStream mStream = new MemoryStream();
+                TripleDESCryptoServiceProvider tdsp = new TripleDESCryptoServiceProvider();
+                tdsp.Mode = CipherMode.CBC;             //默认值  
+                tdsp.Padding = PaddingMode.PKCS7;       //默认值  
+                                                        // Create a CryptoStream using the MemoryStream   
+                                                        // and the passed key and initialization vector (IV).  
+                CryptoStream cStream = new CryptoStream(mStream,
+                    tdsp.CreateEncryptor(key, iv),
+                    CryptoStreamMode.Write);
+                // Write the byte array to the crypto stream and flush it.  
+                cStream.Write(data, 0, data.Length);
+                cStream.FlushFinalBlock();
+                // Get an array of bytes from the   
+                // MemoryStream that holds the   
+                // encrypted data.  
+                byte[] ret = mStream.ToArray();
+                // Close the streams.  
+                cStream.Close();
+                mStream.Close();
+                // Return the encrypted buffer.  
+                return ret;
+            }
+            catch (CryptographicException e)
+            {
+                Console.WriteLine("A Cryptographic error occurred: {0}", e.Message);
+                return null;
+            }
+        }
+        /// <summary>  
+        /// DES3 CBC模式解密  
+        /// </summary>  
+        /// <param name="key">密钥</param>  
+        /// <param name="iv">IV</param>  
+        /// <param name="data">密文的byte数组</param>  
+        /// <returns>明文的byte数组</returns>  
+        public static byte[] Des3DecodeCBC(byte[] key, byte[] iv, byte[] data)
+        {
+            try
+            {
+                // Create a new MemoryStream using the passed   
+                // array of encrypted data.  
+                MemoryStream msDecrypt = new MemoryStream(data);
+                TripleDESCryptoServiceProvider tdsp = new TripleDESCryptoServiceProvider();
+                tdsp.Mode = CipherMode.CBC;
+                tdsp.Padding = PaddingMode.PKCS7;
+                // Create a CryptoStream using the MemoryStream   
+                // and the passed key and initialization vector (IV).  
+                CryptoStream csDecrypt = new CryptoStream(msDecrypt, tdsp.CreateDecryptor(key, iv), CryptoStreamMode.Read);
+                // Create buffer to hold the decrypted data.  
+                byte[] fromEncrypt = new byte[data.Length];
+                // Read the decrypted data out of the crypto stream  
+                // and place it into the temporary buffer.  
+                csDecrypt.Read(fromEncrypt, 0, fromEncrypt.Length);
+                //Convert the buffer into a string and return it.  
+                return fromEncrypt;
+            }
+            catch (CryptographicException e)
+            {
+                Console.WriteLine("A Cryptographic error occurred: {0}", e.Message);
+                return null;
+            }
+        }
+
+        /// <summary>  
+        /// DES3 ECB模式加密  
+        /// </summary>  
+        /// <param name="key">密钥</param>  
+        /// <param name="iv">IV(当模式为ECB时,IV无用)</param>  
+        /// <param name="str">明文的byte数组</param>  
+        /// <returns>密文的byte数组</returns>  
+        public static byte[] Des3EncodeECB(byte[] key, byte[] iv, byte[] data)
+        {
+            try
+            {
+                // Create a MemoryStream.  
+                MemoryStream mStream = new MemoryStream();
+                TripleDESCryptoServiceProvider tdsp = new TripleDESCryptoServiceProvider();
+                tdsp.Mode = CipherMode.ECB;
+                tdsp.Padding = PaddingMode.PKCS7;
+                // Create a CryptoStream using the MemoryStream   
+                // and the passed key and initialization vector (IV).  
+                CryptoStream cStream = new CryptoStream(mStream, tdsp.CreateEncryptor(key, iv), CryptoStreamMode.Write);
+                // Write the byte array to the crypto stream and flush it.  
+                cStream.Write(data, 0, data.Length);
+                cStream.FlushFinalBlock();
+                // Get an array of bytes from the   
+                // MemoryStream that holds the   
+                // encrypted data.  
+                byte[] ret = mStream.ToArray();
+                // Close the streams.  
+                cStream.Close();
+                mStream.Close();
+                // Return the encrypted buffer.  
+                return ret;
+            }
+            catch (CryptographicException e)
+            {
+                Console.WriteLine("A Cryptographic error occurred: {0}", e.Message);
+                return null;
+            }
+        }
+        /// <summary>  
+        /// DES3 ECB模式解密  
+        /// </summary>  
+        /// <param name="key">密钥</param>  
+        /// <param name="iv">IV(当模式为ECB时,IV无用)</param>  
+        /// <param name="str">密文的byte数组</param>  
+        /// <returns>明文的byte数组</returns>  
+        public static byte[] Des3DecodeECB(byte[] key, byte[] iv, byte[] data)
+        {
+
+            // Create a new MemoryStream using the passed   
+            // array of encrypted data.  
+            MemoryStream msDecrypt = new MemoryStream(data);
+            TripleDESCryptoServiceProvider tdsp = new TripleDESCryptoServiceProvider();
+            tdsp.Mode = CipherMode.ECB;
+            tdsp.Padding = PaddingMode.PKCS7;
+            // Create a CryptoStream using the MemoryStream   
+            // and the passed key and initialization vector (IV).  
+            CryptoStream csDecrypt = new CryptoStream(msDecrypt, tdsp.CreateDecryptor(key, iv), CryptoStreamMode.Read);
+            // Create buffer to hold the decrypted data.  
+            byte[] fromEncrypt = new byte[data.Length];
+            // Read the decrypted data out of the crypto stream  
+            // and place it into the temporary buffer.  
+            csDecrypt.Read(fromEncrypt, 0, fromEncrypt.Length);
+            //Convert the buffer into a string and return it.  
+            return fromEncrypt;
+
+        }
+
 
         /// <summary>
         /// 通过DataTable的ColumnName和Caption来拼接一条语句
@@ -41,7 +251,6 @@ namespace UAS_LabelMachine
             DataTable dt = (DataTable)d.DataSource;
             if (dt == null)
             {
-                Console.WriteLine("为空");
                 foreach (DataGridViewColumn dc in d.Columns)
                 {
                     if (dc.DataPropertyName != "" && dc.DataPropertyName != null)
@@ -52,15 +261,11 @@ namespace UAS_LabelMachine
             }
             else
             {
-                Console.WriteLine("不为空");
-                Console.WriteLine(dt.Columns.Count);
                 foreach (DataColumn dc in dt.Columns)
                 {
-                    Console.WriteLine(dc.Caption);
                     selectConetnt.Append(dc.Caption + " as " + dc.ColumnName + ",");
                 }
             }
-            Console.WriteLine(selectConetnt);
             return selectConetnt.Remove(selectConetnt.Length - 1, 1).ToString();
         }
         /// <summary>
@@ -187,15 +392,16 @@ namespace UAS_LabelMachine
         /// <param name="URL"></param>
         /// <param name="LabelName"></param>
         /// <returns></returns>
-        public static string GetLabelUrl(string URL, string LabelName,DateTime time)
+        public static string GetLabelUrl(string URL, string LabelName, DateTime time)
         {
             //如果是传入的数据是从FTP取的文件
             if (URL.Contains("ftp:"))
             {
                 ftpOperater ftp = new ftpOperater();
-                return ftp.Download(LabelName,time);
+                return ftp.Download(LabelName, time);
             }
-            else {
+            else
+            {
                 return URL;
             }
         }
@@ -228,7 +434,8 @@ namespace UAS_LabelMachine
                 }
             }
             //否则直接获取全部的数据
-            else {
+            else
+            {
                 for (int i = 0; i < dgv.RowCount; i++)
                 {
                     for (int j = 0; j < ColumnName.Length; j++)
@@ -522,7 +729,8 @@ namespace UAS_LabelMachine
                     {
                         condition += "(" + Condition[i].Tag + " like " + "'%" + (Condition[i] as ComboBox).SelectedValue + "%' or " + Condition[i].Tag + " is null)  and ";
                     }
-                    else {
+                    else
+                    {
                         condition += "(" + Condition[i].Tag + " like " + "'%" + Condition[i].Text + "%' or " + Condition[i].Tag + " is null) and ";
                     }
                 }
@@ -532,7 +740,8 @@ namespace UAS_LabelMachine
                     {
                         condition += "(" + Condition[i].Tag + " like " + "'%" + (Condition[i] as ComboBox).SelectedValue + "%' or " + Condition[i].Tag + " is null)";
                     }
-                    else {
+                    else
+                    {
                         condition += "(" + Condition[i].Tag + " like " + "'%" + Condition[i].Text + "%' or " + Condition[i].Tag + " is null)";
                     }
                 }

+ 5 - 0
UAS-出货标签管理/PublicMethod/DataHelper.cs

@@ -14,6 +14,8 @@ namespace UAS_LabelMachine
         //ftp://richwellgroup.com.cn|printuser|printuser
         //怡海能达FTP
         //ftp://sz.hi-mantech.com:46688|yhndftp|Stga28ytG8
+        //华商龙FTP
+        //ftp://10.1.1.38|Print|Administrator1@#
         //系统默认的的连接字符串
         //private readonly string ConnectionStrings = "Data Source=218.17.158.219/orcl;User ID=UAS_DEV;PassWord=select!#%*(";
         //富为内网地址
@@ -24,6 +26,8 @@ namespace UAS_LabelMachine
         private readonly string ConnectionStrings = "Data Source=sz.hi-mantech.com/orcl;User ID=YHND_SZ;PassWord=select!#%*(";
         //怡海能达内网地址
         //private readonly string ConnectionStrings = "Data Source=192.168.1.200/orcl;User ID=DATACENTER;PassWord=select!#%*(";
+        //华商龙外网地址
+        //private readonly string ConnectionStrings = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=YITOA_DATACENTER;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=218.18.115.198)(PORT=1523)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
         //用户选择的数据库的连接字符串
         public static string DBConnectionString;
         static OracleConnection connection = null;
@@ -771,6 +775,7 @@ namespace UAS_LabelMachine
         /// <returns></returns>
         public object ExecuteSql(string SQL, string Type, params object[] names)
         {
+            Console.WriteLine(SQL);
             object result = null;
             command = new OracleCommand(SQL, connection);
             //用来拼接参数的

+ 9 - 0
UAS-出货标签管理/UAS-出货标签管理.csproj

@@ -652,6 +652,15 @@
     <None Include="Resources\preview_16px_25980_easyicon.net.png" />
   </ItemGroup>
   <ItemGroup>
+    <COMReference Include="BarTender">
+      <Guid>{D58562C1-E51B-11CF-8941-00A024A9083F}</Guid>
+      <VersionMajor>7</VersionMajor>
+      <VersionMinor>75</VersionMinor>
+      <Lcid>0</Lcid>
+      <WrapperTool>tlbimp</WrapperTool>
+      <Isolated>False</Isolated>
+      <EmbedInteropTypes>False</EmbedInteropTypes>
+    </COMReference>
     <COMReference Include="stdole">
       <Guid>{00020430-0000-0000-C000-000000000046}</Guid>
       <VersionMajor>2</VersionMajor>

+ 2 - 2
UAS-出货标签管理/客户标签维护.cs

@@ -72,12 +72,12 @@ namespace UAS_LabelMachine
 
             cu_code.FormName = Name;
             cu_code.SetValueField = new string[] { "cu_code", "cu_name" };
-            cu_code.TableName = "customer left join customerlabel on cu_code=cl_custcode";
+            cu_code.TableName = "(select distinct cu_code,cu_name from customer left join customerlabel on cu_code=cl_custcode)";
             cu_code.SelectField = "cu_code # 客户编号,cu_name # 客户名称";
 
             客户编号.FormName = Name;
             客户编号.SetValueField = new string[] { "客户编号" };
-            客户编号.TableName = "customer left join customerlabel on cu_code=cl_custcode";
+            客户编号.TableName = "(select distinct cu_code,cu_name from customer left join customerlabel on cu_code=cl_custcode)";
             客户编号.SelectField = "cu_code # 客户编号,cu_name # 客户名称";
 
             la_code.FormName = Name;