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

Merge branch 'master' of ssh://10.10.100.21/source/mes-client

Hcsy 7 лет назад
Родитель
Сommit
27cd911c92

+ 0 - 212
UAS-出货标签管理/PublicMethod/BaseUtil.cs

@@ -6,9 +6,7 @@ using System.Text;
 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;
 using System.Text.RegularExpressions;
 
 namespace UAS_LabelMachine
@@ -18,8 +16,6 @@ namespace UAS_LabelMachine
 
         static string SysDisc;
 
-        private string Key = "96878265";
-
         public static string SysDisc1
         {
             get
@@ -33,214 +29,6 @@ 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来拼接一条语句
         /// </summary>

+ 11 - 15
UAS-出货标签管理/PublicMethod/DataHelper.cs

@@ -10,28 +10,25 @@ namespace UAS_LabelMachine
 {
     public class DataHelper
     {
-        //富为FTP
-        //ftp://richwellgroup.com.cn|printuser|printuser
-        //怡海能达FTP
-        //ftp://sz.hi-mantech.com:46688|yhndftp|Stga28ytG8
-        //华商龙FTP
-        //ftp://218.18.115.198:21|Print|Administrator1@#
-        //系统默认的的连接字符串
-        //private readonly string ConnectionStrings = "Data Source=218.17.158.219/orcl;User ID=UAS_DEV;PassWord=select!#%*(";
-        //富为内网地址
-        //private readonly string ConnectionStrings = "Data Source=192.168.0.88/orcl;User ID=DATACENTER;PassWord=select!#%*(";
+
         //富为外网地址
         //private readonly string ConnectionStrings = "Data Source=richwellgroup.com.cn/orcl;User ID=DATACENTER;PassWord=select!#%*(";
+        //富为FTP
+        //public static readonly string FTPAdress = "ftp://richwellgroup.com.cn|printuser|printuser";
+
         //怡海能达外网地址
-        //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 = "Data Source=sz.hi-mantech.com/orcl;User ID=DATACENTER;PassWord=select!#%*(";
         //怡海能达ERP地址
         //public static readonly string ERPAddesss = "http://sz.hi-mantech.com:8099/ERP/";
+        //怡海能达FTP
+        //public static readonly string FTPAdress = "ftp://sz.hi-mantech.com:46688|yhndftp|Stga28ytG8";
+
         //华商龙外网地址
         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)));";
-        //ERP的地址
+        //华商龙ERP地址
         public static readonly string ERPAddesss = "http://218.18.115.198:8888/ERP/";
+        //华商龙FTP
+        public static readonly string FTPAdress = "ftp://218.18.115.198:21|Print|Administrator1@#";
 
         //用户选择的数据库的连接字符串
         public static string DBConnectionString;
@@ -779,7 +776,6 @@ 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);
             //用来拼接参数的

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

@@ -680,7 +680,6 @@ namespace UAS_LabelMachine
         private void RemindUser()
         {
             SetRowIndexToCollectRow();
-
             if (ScanData.ToArray().Length > 0)
             {
                 object[] arr = (ScanData.ToArray()[CurrentItemIndex] as ArrayList<string>).ToArray();

+ 2 - 1
UAS_Web/PrinterList.Designer.cs

@@ -35,6 +35,7 @@
             // 
             // Printer
             // 
+            this.Printer.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
             this.Printer.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.Printer.FormattingEnabled = true;
             this.Printer.Location = new System.Drawing.Point(29, 38);
@@ -50,7 +51,7 @@
             this.Confirm.TabIndex = 1;
             this.Confirm.Text = "确认";
             this.Confirm.UseVisualStyleBackColor = true;
-            //
+            // 
             // PrinterList
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);

+ 1 - 1
UAS_Web/Program.cs

@@ -25,7 +25,7 @@ namespace UAS_Web
                 //处理非UI线程异常
                 AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
                 #region 应用程序的主入口点
-                var setting = new CefSettings();
+                var setting = new CefSettings() { IgnoreCertificateErrors = true };
                 setting.CefCommandLineArgs.Add("disable-gpu", "1");
                 Cef.Initialize(setting);
                 Application.EnableVisualStyles();

+ 2 - 2
UAS_Web/tool/RequestHandler.cs

@@ -30,7 +30,7 @@ namespace UAS_Web.tool
             MessageFilter filter;
             switch (request.Url.Substring(request.Url.LastIndexOf("/") + 1))
             {
-                case "default?type=printer":
+                case "zplPrinter":
                     filter = FilterManager.CreateFilter(request.Identifier.ToString()) as MessageFilter;
                     return filter;
                 case "zplPrint.action":
@@ -62,7 +62,7 @@ namespace UAS_Web.tool
             Dictionary<string, object> data;
             switch (request.Url.Substring(request.Url.LastIndexOf("/") + 1))
             {
-                case "default?type=printer":
+                case "zplPrinter":
                     //弹出打印机选择列表
                     print = new PrinterList(browser) { StartPosition = FormStartPosition.CenterScreen };
                     print.Controls["Confirm"].Click += RequestHandler_Click;