章政 пре 7 година
родитељ
комит
92c32c1bcc

+ 64 - 591
UAS_MesInterface/DataHelper.cs

@@ -2,37 +2,52 @@
 using System;
 using System.Data;
 using System.Text;
-using System.Collections.Generic;
+using System.Runtime.InteropServices;
 
 namespace DllService
 {
-    /// <summary>
-    /// 数据库操作类
-    /// </summary>
-    class DataHelper
+    [Guid("67D63258-6F70-400C-BE1A-1AFE54384004")]
+    [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
+    private interface IDataHelper
+    {
+        [DispId(8)]
+        object getFieldDataByCondition(string TableName, string Field, string Condition);
+        DataTable getFieldsDataByCondition(string TableName, string[] Fields, string Condition);
+        DataTable getFieldsDatas(string TableName, string Fields);
+        bool CheckExist(string TableName, string Condition);
+        object ExecuteSql(string SQL, string Type, params object[] names);
+        void BatchInsert(string sql, params object[][] names);
+        string UpdateByCondition(string TableName, string update, string condition);
+        void CallProcedure(string ProcedureName, ref string[] param);
+    }
+
+    [Guid("1886A2C6-7BDF-4990-A9B9-F3228DEC0906")]
+    [ClassInterface(ClassInterfaceType.None)]
+    [ComSourceInterfaces(typeof(IDataHelper))]
+    [ProgId("DllService.DataHelper")]
+    private class DataHelper : IDataHelper
     {
         //系统默认的的连接字符串
         private string ConnectionStrings = "";
         //用户选择的数据库的连接字符串
-        public static OracleConnection connection = null;
+        private OracleConnection connection = null;
         //用户选择的数据库的连接字符串
-        OracleCommand command = new OracleCommand();
-        /// <summary>
-        /// 执行构造函数的时候打开数据库的链接
-        /// </summary>
-        public DataHelper(string Environment)
+        OracleCommand command =null;
+
+        private DataHelper()
         {
+            string Environment = "MES_TEST";
             try
             {
                 //如果选择的是默认数据则直接用配置文件的信息连接,否则选择数据库的账套信息
                 if (Environment.ToUpper() == "MES")
                 {
-                    ConnectionStrings = "Password=select!#%*(;User ID=MES;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.230.200)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
+                    ConnectionStrings = "Password=select!#%*(;User ID=MES;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=117.25.180.218)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
                     connection = new OracleConnection(ConnectionStrings);
                 }
                 else if (Environment.ToUpper() == "MES_TEST")
                 {
-                    ConnectionStrings = "Password=select!#%*(;User ID=MES_TEST;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.230.200)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
+                    ConnectionStrings = "Password=select!#%*(;User ID=MES_TEST;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=117.25.180.218)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
                     connection = new OracleConnection(ConnectionStrings);
                 }
                 command.Connection = connection;
@@ -43,12 +58,12 @@ namespace DllService
             {
                 if (Environment.ToUpper() == "MES")
                 {
-                    ConnectionStrings = "Password=select!#%*(;User ID=MES;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.230.200)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
+                    ConnectionStrings = "Password=select!#%*(;User ID=MES;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=117.25.180.218)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
                     connection = new OracleConnection(ConnectionStrings);
                 }
                 else if (Environment.ToUpper() == "MES_TEST")
                 {
-                    ConnectionStrings = "Password=select!#%*(;User ID=MES_TEST;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.230.200)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
+                    ConnectionStrings = "Password=select!#%*(;User ID=MES_TEST;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=117.25.180.218)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
                     connection = new OracleConnection(ConnectionStrings);
                 }
                 try
@@ -63,30 +78,15 @@ namespace DllService
                 command.CommandTimeout = 0;
             }
         }
-        /// <summary>
-        /// 根据表名获取该表字段数据类型
-        /// </summary>
-        public DataTable GetColumnDataType(string TableName)
-        {
-            DataTable dt = new DataTable();
-            command.CommandText = "select Column_Name,Data_Type from cols where TABLE_name=upper('" + TableName + "')";
-            command.CommandType = CommandType.Text;
-            Reconnect(command);
-            OracleDataAdapter ad = new OracleDataAdapter(command);
-            ad.Fill(dt);
-            ad.Dispose();
-            return dt;
-        }
 
         /// <summary>
         /// 获取第一行第一列的信息
         /// </summary>
-        public object getFieldDataByCondition(string TableName, string Field, string Condition)
+        private object getFieldDataByCondition(string TableName, string Field, string Condition)
         {
             DataTable dt = new DataTable();
             string sql = "select " + Field + " from " + TableName + " where " + Condition;
-            command.CommandText = sql;
-            command.CommandType = CommandType.Text;
+            command = new OracleCommand(sql, connection);
             Reconnect(command);
             OracleDataAdapter ad = new OracleDataAdapter();
             ad.SelectCommand = command;
@@ -98,13 +98,13 @@ namespace DllService
             {
                 connection = new OracleConnection(ConnectionStrings);
                 connection.Open();
-                command.Connection = connection;
+                command = new OracleCommand(sql, connection);
                 ad = new OracleDataAdapter();
                 ad.SelectCommand = command;
                 ad.Fill(dt);
             }
             ad.Dispose();
-
+            command.Dispose();
             if (dt.Rows.Count > 0)
             {
                 return dt.Rows[0][0];
@@ -115,87 +115,17 @@ namespace DllService
             }
         }
 
-        /// <summary>
-        /// 执行打印的SQL
-        /// </summary>
-        /// <param name="SQL">SQL语句</param>
-        /// <param name="Parameters">动态添加的参数,主要根据条码枪扫描获取</param>
-        /// <returns></returns>
-        public object ExecutePrintSQL(string SQL, params string[] Parameters)
-        {
-            command.Parameters.Clear();
-            //按照?拆分数据,然后以:Param替换问号,同时添加参数
-            string[] Param = SQL.Split('?');
-            int ParamNum = Param.Length - 1;
-            //条码打印必然存在需要维护的参数
-            if (ParamNum > 0)
-            {
-                StringBuilder sb = new StringBuilder();
-                for (int i = 0; i < ParamNum; i++)
-                {
-                    sb.Append(Param[i] + ":Param" + i);
-                }
-                command.CommandText = sb.ToString();
-                command.CommandType = CommandType.Text;
-                for (int i = 0; i < ParamNum; i++)
-                {
-                    command.Parameters.Add("Param" + i, OracleDbType.Varchar2, Parameters[i], ParameterDirection.Input);
-                }
-                OracleDataAdapter ad = new OracleDataAdapter(command);
-                DataTable dt = new DataTable();
-                ad.Fill(dt);
-                ad.Dispose();
-                return dt;
-            }
-            return "参数错误,请检查SQL语句";
-        }
-
-        /// <summary>
-        /// 获取指定表的记录的条数 ,带条件
-        /// </summary>
-        /// <returns></returns>
-        public int getRowCount(string TableName, string Condition)
-        {
-            DataTable dt = new DataTable();
-            string sql = "select count(1) from " + TableName + " where " + Condition;
-            command.CommandText = sql;
-            command.CommandType = CommandType.Text;
-            Reconnect(command);
-            OracleDataAdapter ad = new OracleDataAdapter(command);
-            ad.Fill(dt);
-            ad.Dispose();
-            return int.Parse(dt.Rows[0][0].ToString());
-        }
-
-        /// <summary>
-        /// 获取指定表的记录的条数 ,不带条件
-        /// </summary>
-        /// <param name="TableName"></param>
-        /// <returns></returns>
-        public int getRowCount(string TableName)
-        {
-            DataTable dt = new DataTable();
-            string sql = "select count(1) from " + TableName;
-            command.CommandText = sql;
-            command.CommandType = CommandType.Text;
-            Reconnect(command);
-            OracleDataAdapter ad = new OracleDataAdapter(command);
-            ad.Fill(dt);
-            ad.Dispose();
-            return int.Parse(dt.Rows[0][0].ToString());
-        }
 
         /// <summary>
         /// 通过表名和获取单行的记录
         /// </summary>
-        public DataTable getFieldsDataByCondition(string TableName, string[] Fields, string Condition)
+        private DataTable getFieldsDataByCondition(string TableName, string[] Fields, string Condition)
         {
             DataTable dt = new DataTable();
             string sql = "select ";
             sql += AddField(Fields);
             sql += " from " + TableName + " where " + Condition + " and rownum=1";
-            command.CommandText = sql;
-            command.CommandType = CommandType.Text;
+            command = new OracleCommand(sql, connection);
             Reconnect(command);
             OracleDataAdapter ad = new OracleDataAdapter(command);
             try
@@ -206,71 +136,26 @@ namespace DllService
             {
                 connection = new OracleConnection(ConnectionStrings);
                 connection.Open();
-                command.Connection = connection;
+                command = new OracleCommand(sql, connection);
                 ad = new OracleDataAdapter();
                 ad.SelectCommand = command;
                 ad.Fill(dt);
             }
             ad.Dispose();
-
-            return dt;
-        }
-
-        /// <summary>
-        /// 按分页获取数据
-        /// </summary>
-        /// <param name="TableName">表名</param>
-        /// <param name="Fields">查询字段</param>
-        /// <param name="CurrentPage">当前页面</param>
-        /// <param name="PageSize">页面展示条数</param>
-        /// <param name="Caller"></param>
-        /// <returns></returns>
-        // SELECT * FROM (SELECT   A.*  FROM (SELECT* FROM datalist) A WHERE ROWNUM <= 50) WHERE ROWNUM >= 21
-        public DataTable getFieldsDatasByPageing(string TableName, string Fields, int CurrentPage, int PageSize, string Caller, params string[] condition)
-        {
-            DataTable dt = new DataTable();
-            StringBuilder sql = new StringBuilder();
-            //先查询出配置出去的列
-            //获取查询的列
-            string[] caption = GetCaptionFromField(Fields);
-            //获取对应列的描述
-            string[] field = GetField(Fields);
-            sql.Append(" select * from (select RowNum RN, A.* from (select ");
-            sql.Append(AddField(caption));
-            if (condition.Length > 0)
-            {
-                if (condition[0] != null && condition[0].Trim() != "")
-                    sql.Append(" from " + TableName + " where " + condition[0] + " ) A where ROWNUM <=" + CurrentPage * PageSize + ") where RN>" + (CurrentPage - 1) * PageSize);
-                else
-                    sql.Append(" from " + TableName + ") A where ROWNUM <= " + CurrentPage * PageSize + ") where RN> " + (CurrentPage - 1) * PageSize);
-            }
-            command.CommandText = sql.ToString();
-            command.CommandType = CommandType.Text;
-            Reconnect(command);
-            OracleDataAdapter ad = new OracleDataAdapter(command);
-            ad.Fill(dt);
-            ad.Dispose();
-
-            dt.Columns.RemoveAt(0);
-            foreach (DataColumn dc in dt.Columns)
-            {
-                dc.ColumnName = field[dt.Columns.IndexOf(dc)];
-                dc.Caption = caption[dt.Columns.IndexOf(dc)];
-            }
+            command.Dispose();
             return dt;
         }
 
         /// <summary>
         /// 通过表名,字段和条件获取DataTable类型的数据
         /// </summary>
-        public DataTable getFieldsDatasByCondition(string TableName, string[] Fields, string Condition)
+        private DataTable getFieldsDatasByCondition(string TableName, string[] Fields, string Condition)
         {
             DataTable dt = new DataTable();
             string sql = "select ";
             sql += AddField(Fields);
             sql += " from " + TableName + " where " + Condition;
-            command.CommandText = sql;
-            command.CommandType = CommandType.Text;
+            command = new OracleCommand(sql, connection);
             Reconnect(command);
             OracleDataAdapter ad = new OracleDataAdapter(command);
             try
@@ -281,27 +166,26 @@ namespace DllService
             {
                 connection = new OracleConnection(ConnectionStrings);
                 connection.Open();
-                command.Connection = connection;
+                command = new OracleCommand(sql, connection);
                 ad = new OracleDataAdapter();
                 ad.SelectCommand = command;
                 ad.Fill(dt);
             }
             ad.Dispose();
-
+            command.Dispose();
             return dt;
         }
 
         /// <summary>
         /// 通过表名,字段获取DataTable类型的数据
         /// </summary>
-        public DataTable getFieldsDatas(string TableName, string Fields)
+        private DataTable getFieldsDatas(string TableName, string Fields)
         {
             DataTable dt = new DataTable();
             string sql = "select ";
             sql += Fields;
             sql += " from " + TableName;
-            command.CommandText = sql;
-            command.CommandType = CommandType.Text;
+            command = new OracleCommand(sql, connection);
             Reconnect(command);
             OracleDataAdapter ad = new OracleDataAdapter(command);
             ad.SelectCommand = command;
@@ -313,12 +197,13 @@ namespace DllService
             {
                 connection = new OracleConnection(ConnectionStrings);
                 connection.Open();
-                command.Connection = connection;
+                command = new OracleCommand(sql, connection);
                 ad = new OracleDataAdapter();
                 ad.SelectCommand = command;
                 ad.Fill(dt);
             }
             ad.Dispose();
+            command.Dispose();
             return dt;
         }
 
@@ -328,16 +213,16 @@ namespace DllService
         /// <param name="TableName"></param>
         /// <param name="Condition"></param>
         /// <returns></returns>
-        public bool CheckExist(string TableName, string Condition)
+        private bool CheckExist(string TableName, string Condition)
         {
             string sql = "select count(1) from " + TableName + " where " + Condition;
-            command.CommandText = sql;
-            command.CommandType = CommandType.Text;
+            command = new OracleCommand(sql, connection);
             Reconnect(command);
             OracleDataAdapter ad = new OracleDataAdapter(command);
             DataTable dt = new DataTable();
             ad.Fill(dt);
             ad.Dispose();
+            command.Dispose();
             return int.Parse(dt.Rows[0][0].ToString()) > 0;
         }
 
@@ -347,12 +232,10 @@ namespace DllService
         /// <param name="SQL"></param>
         /// <param name="Type"></param>
         /// <returns></returns>
-        public object ExecuteSql(string SQL, string Type, params object[] names)
+        private object ExecuteSql(string SQL, string Type, params object[] names)
         {
-            command.Parameters.Clear();
             object result = null;
-            command.CommandText = SQL;
-            command.CommandType = CommandType.Text;
+            command = new OracleCommand(SQL, connection);
             Reconnect(command);
             //用来拼接参数的
             if (names.Length > 0)
@@ -393,7 +276,7 @@ namespace DllService
                     {
                         connection = new OracleConnection(ConnectionStrings);
                         connection.Open();
-                        command.Connection = connection;
+                        command = new OracleCommand(SQL, connection);
                         ad = new OracleDataAdapter();
                         ad.SelectCommand = command;
                         ad.Fill((DataTable)result);
@@ -436,224 +319,19 @@ namespace DllService
                     }
                     break;
             }
+            command.Dispose();
             return result;
         }
 
-        /// <summary>
-        /// 为了同步BS端的条码维护,检测时允许问号的存在,在检测时默认将问号换成:Param参数
-        /// </summary>
-        /// <param name="SQL"></param>
-        public void CheckSQL(string SQL)
-        {
-            SQL = SQL.Replace("?", ":Param");
-            command.CommandText = SQL;
-            command.CommandType = CommandType.Text;
-            command.ExecuteNonQuery();
-        }
-
-        public int GetDistinctRowCount(string TableName, string Field)
-        {
-            DataTable dt = new DataTable();
-            string sql = "select distinct count('" + Field + "') from " + TableName;
-            command.CommandText = sql;
-            command.CommandType = CommandType.Text;
-            Reconnect(command);
-            OracleDataAdapter ad = new OracleDataAdapter(command);
-            try
-            {
-                ad.Fill(dt);
-            }
-            catch (Exception)
-            {
-                connection = new OracleConnection(ConnectionStrings);
-                connection.Open();
-                command.Connection = connection;
-                ad = new OracleDataAdapter();
-                ad.SelectCommand = command;
-                ad.Fill(dt);
-            }
-            ad.Dispose();
-            return int.Parse(dt.Rows[0][0].ToString());
-        }
-
-        /// <summary>
-        /// 根据Caller获取流水号
-        /// </summary>
-        /// <param name="Caller"></param>
-        /// <returns></returns>
-        public string GetSerialNumberByCaller(string Caller)
-        {
-            string SerialNumber = getFieldDataByCondition("MaxNumbers", "mn_number", "mn_tablename='" + Caller + "'").ToString();
-            UpdateByCondition("MaxNumbers", "mn_number=mn_number+1", "mn_tablename='" + Caller + "'");
-            return SerialNumber;
-        }
-
-        /// <summary>
-        /// 根据主键ID删除表的数据
-        /// </summary>
-        /// <param name="TableName">表名</param>
-        /// <param name="ID">主键</param>
-        /// <param name="DeleteID">需要删除主键ID的数组</param>
-        public void DeleteDataByID(string TableName, string ID, string[] DeleteID)
-        {
-            command.Parameters.Clear();
-            string sql = "delete from " + TableName + " where " + ID + " =:DeleteID";
-            command.CommandText = sql;
-            command.CommandType = CommandType.Text;
-            Reconnect(command);
-            command.ArrayBindCount = DeleteID.Length;
-            command.Parameters.Add(new OracleParameter("DeleteID", OracleDbType.Long, DeleteID, ParameterDirection.Input));
-            try
-            {
-                command.ExecuteNonQuery();
-                command.ArrayBindCount = 0;
-            }
-            catch (Exception)
-            {
-                command.Connection = new OracleConnection(ConnectionStrings);
-                command.Connection.Open();
-                command.ExecuteNonQuery();
-                command.ArrayBindCount = 0;
-            }
-        }
-
-        /// <summary>
-        /// 通过序列的名称获取序列
-        /// </summary>
-        /// <param name="SeqName"></param>
-        /// <returns></returns>
-        public string GetSEQ(string SeqName)
-        {
-            DataTable dt = new DataTable();
-            dt = (DataTable)ExecuteSql("SELECT " + SeqName + ".NEXTVAL FROM DUAL", "select");
-            return dt.Rows[0][0].ToString();
-        }
-
-        /// <summary>
-        /// 通过序列的名称获取序列
-        /// </summary>
-        /// <param name="SeqName"></param>
-        /// <returns></returns>
-        public string[] GetSEQ(string SeqName, int Num)
-        {
-            DataTable dt = new DataTable();
-            dt = (DataTable)ExecuteSql("select " + SeqName + ".nextval from (select 1 from OQCITEMSAMPLES where rownum<" + (Num + 1) + ")", "select");
-            string[] SerialNum = new string[dt.Rows.Count];
-            for (int i = 0; i < dt.Rows.Count; i++)
-            {
-                SerialNum[i] = dt.Rows[i][0].ToString();
-            }
-            return SerialNum;
-        }
-
-        public void SaveDataTable(DataTable dt, string TableName, string ID, params string[] sql)
-        {
-            if (dt == null)
-            {
-                return;
-            }
-            StringBuilder sb = new StringBuilder();
-            //预防插入的DataTable中存在不属于该表的列,在进行下一步操作之前全部剔除
-            DataTable data = (DataTable)ExecuteSql("select Column_Name,Data_Type from cols where TABLE_name=upper('" + TableName + "')", "select");
-            //将所有的字段拼接起来
-            for (int i = 0; i < data.Rows.Count; i++)
-            {
-                sb.Append("#" + data.Rows[i]["Column_Name"].ToString());
-            }
-            //移除掉所有不属于该表的列
-            for (int i = dt.Columns.Count - 1; i >= 0; i--)
-            {
-                if (!sb.ToString().Contains(dt.Columns[i].ColumnName.ToUpper()))
-                {
-                    dt.Columns.RemoveAt(i);
-                }
-            }
-            sb.Clear();
-            //计算有多少个是新加的行,根据主键为空来进行判断
-            int NewRowCount = 0;
-            for (int i = 0; i < dt.Rows.Count; i++)
-            {
-                if (dt.Rows[i][ID] == null || dt.Rows[i][ID].ToString() == "")
-                {
-                    NewRowCount = NewRowCount + 1;
-                }
-            }
-            if (sql.Length > 0)
-            {
-                if (NewRowCount > 0)
-                {
-                    //获取参数的个数
-                    int paramsNum = sql[0].Split(':').Length - 1;
-                    //解析参数的数据
-                    string[] param = GetParamFromSQL(sql[0]);
-                    //新建一个二维数组去
-                    string[][] param_array = new string[paramsNum][];
-                    //实例化每个一维数组
-                    for (int i = 0; i < paramsNum; i++)
-                    {
-                        param_array[i] = new string[NewRowCount];
-                    }
-                    //设置每列参数的索引
-                    int num = 0;
-                    //变量所有的行,如果有主键为空的则移除,不为空的进行参数的拼接
-                    for (int i = dt.Rows.Count - 1; i >= 0; i--)
-                    {
-                        if (dt.Rows[i][ID] == null || dt.Rows[i][ID].ToString() == "")
-                        {
-                            //当为新添加行的时候才去设置参数,设置过后索引+1
-                            for (int j = 0; j < paramsNum; j++)
-                            {
-                                param_array[j][num] = dt.Rows[i][param[j]].ToString();
-                            }
-                            dt.Rows.RemoveAt(i);
-                            num++;
-                        }
-                    }
-                    BatchInsertDataTable(sql[0], param, param_array);
-                }
-            }
-            sb.Clear();
-            sb.Append("update " + TableName + " set ");
-            int ColumnCount = dt.Columns.Count;
-            int RowCount = dt.Rows.Count;
-            //存数据的参数
-            List<string[]> Parameter = new List<string[]>();
-            //存参数名的参数
-            string[] ParName = new string[ColumnCount];
-            for (int i = 0; i < ColumnCount; i++)
-            {
-                ParName[i] = dt.Columns[i].ColumnName;
-                if (i == dt.Columns.Count - 1)
-                    sb.Append(dt.Columns[i].ColumnName + "=:" + dt.Columns[i].ColumnName);
-                else
-                    sb.Append(dt.Columns[i].ColumnName + "=:" + dt.Columns[i].ColumnName + ",");
-            }
-            sb.Append(" where " + ID + " =:" + ID);
-            //先添加参数
-            Parameter.Add(ParName);
-            //添加参数的具体内容
-            for (int i = 0; i < ColumnCount; i++)
-            {
-                string[] par = new string[RowCount];
-                for (int j = 0; j < RowCount; j++)
-                {
-                    par[j] = dt.Rows[j][i].ToString();
-                }
-                Parameter.Add(par);
-            }
-            BatchInsert(sb.ToString(), Parameter.ToArray());
-        }
-
         /// <summary>
         /// 批量通过SQL来执行插入操作 ,参数的第一个数一个string[]数组,用来传递需要添加的参数的名称
         /// 之后的是名称参数数组对应的 ,所有的插入参数数据长度必须是一致的
         /// </summary>
         /// <param name="sql"></param>
         /// <param name="names"></param>
-        public void BatchInsert(string sql, params object[][] names)
+        private void BatchInsert(string sql, params object[][] names)
         {
-            command.Parameters.Clear();
-            command.CommandText = sql;
+            command = new OracleCommand(sql, connection);
             Reconnect(command);
             command.ArrayBindCount = names[1].Length;
             //因为第一个数组保存的是参数的名称,所以循环从1而不是0开始
@@ -665,96 +343,14 @@ namespace DllService
             try
             {
                 command.ExecuteNonQuery();
-                command.ArrayBindCount = 0;
-            }
-            catch (Exception)
-            {
-                command.Connection = new OracleConnection(ConnectionStrings);
-                command.Connection.Open();
-                command.ExecuteNonQuery();
-                command.ArrayBindCount = 0;
-            }
-        }
-
-        public void BatchInsertDataTable(string sql, string[] param, params object[][] param1)
-        {
-            command.Parameters.Clear();
-            command.CommandText = sql;
-            Reconnect(command);
-            command.ArrayBindCount = param1[0].Length;
-            //因为第一个数组保存的是参数的名称,所以循环从1而不是0开始
-            //将第一个数组的下标固定为0作为循环添加的参数的名称
-            for (int i = 0; i < param.Length; i++)
-            {
-                command.Parameters.Add(new OracleParameter(param[i].ToString(), OracleDbType.Varchar2, param1[i], ParameterDirection.Input));
-            }
-            try
-            {
-                command.ExecuteNonQuery();
-                command.ArrayBindCount = 0;
             }
             catch (Exception)
             {
                 command.Connection = new OracleConnection(ConnectionStrings);
                 command.Connection.Open();
                 command.ExecuteNonQuery();
-                command.ArrayBindCount = 0;
             }
-        }
-
-        /// <summary>
-        /// 取Configs表中的配置,进行该客户是否执行某个操作
-        /// </summary>
-        /// <param name="Code"></param>
-        /// <param name="Caller"></param>
-        /// <returns></returns>
-        public object GetConfig(string Code, string Caller)
-        {
-            DataTable dt = new DataTable();
-            string sql = "select Data from configs where code='" + Code + "' and caller='" + Caller + "'";
-            dt = (DataTable)ExecuteSql(sql, "select");
-            if (dt.Rows.Count == 0)
-            {
-                return "";
-            }
-            else
-            {
-                return dt.Rows[0]["Data"];
-            }
-        }
-
-
-        //将数据类型的列类型转换为DataTable
-        public DataTable DataTypeColumnToDataTable(DataTable dt)
-        {
-            DataTable dt1 = new DataTable();
-            dt1.Rows.Add();
-            foreach (DataRow dr in dt.Rows)
-            {
-                dt1.Columns.Add(dr[0].ToString());
-                int index = dt.Rows.IndexOf(dr);
-                if (dr[1].ToString() == "NUMBER")
-                {
-                    dt1.Rows[0][index] = 0;
-                }
-                if (dr[1].ToString() == "VARCHAR2")
-                {
-                    dt1.Rows[0][index] = "这是一段文字";
-                }
-                if (dr[1].ToString() == "DATE")
-                {
-                    dt1.Rows[0][index] = DateTime.Now.ToString("yyyy-MM-dd");
-                }
-                if (dr[1].ToString() == "FLOAT")
-                {
-                    dt1.Rows[0][index] = 1.0;
-                }
-                if (dr[1].ToString() == "CLOB")
-                {
-                    dt1.Rows[0][index] = "一段长文字";
-                }
-            }
-            return dt1;
+            command.Dispose();
         }
 
         /// <summary>
@@ -763,11 +359,10 @@ namespace DllService
         /// <param name="TableName"></param>
         /// <param name="update"></param>
         /// <param name="condition"></param>
-        public string UpdateByCondition(string TableName, string update, string condition)
+        private string UpdateByCondition(string TableName, string update, string condition)
         {
             string sql = "update " + TableName + " set " + update + " where " + condition;
-            command.CommandText = sql;
-            command.CommandType = CommandType.Text;
+            command = new OracleCommand(sql, connection);
             Reconnect(command);
             try
             {
@@ -779,6 +374,7 @@ namespace DllService
                 command.Connection.Open();
                 command.ExecuteNonQuery();
             }
+            command.Dispose();
             return sql;
         }
 
@@ -787,13 +383,13 @@ namespace DllService
         /// </summary>
         /// <param name="ProcedureName"></param>    
         /// <param name="param"></param>
-        public void CallProcedure(string ProcedureName, ref string[] param)
+        private void CallProcedure(string ProcedureName, ref string[] param)
         {
-            command.Parameters.Clear();
+            command = new OracleCommand(ProcedureName);
+            command.Connection = connection;
+            Reconnect(command);
             command.CommandText = ProcedureName;
             command.CommandType = CommandType.StoredProcedure;
-            command.ArrayBindCount = 0;
-            Reconnect(command);
             for (int i = 0; i < param.Length; i++)
                 command.Parameters.Add(new OracleParameter(param[i].ToString(), OracleDbType.Varchar2, 200, param[i], ParameterDirection.InputOutput));
             try
@@ -810,43 +406,6 @@ namespace DllService
                 param[i] = command.Parameters[i].Value.ToString();
         }
 
-        /// <summary>
-        /// 出现异常进行回滚的执行方法
-        /// </summary>
-        /// <param name="SQL"></param>
-        public void ExecuteSQLTran(params string[] SQL)
-        {
-            OracleTransaction tx = connection.BeginTransaction();
-            command.Transaction = tx;
-            try
-            {
-                foreach (string sql in SQL)
-                {
-                    if (!string.IsNullOrEmpty(sql))
-                    {
-                        command.CommandText = sql;
-                        command.CommandType = CommandType.Text;
-                        try
-                        {
-                            command.ExecuteNonQuery();
-                        }
-                        catch (Exception)
-                        {
-                            command.Connection = new OracleConnection(ConnectionStrings);
-                            command.Connection.Open();
-                            command.ExecuteNonQuery();
-                        }
-                    }
-                }
-                tx.Commit();
-            }
-            catch (System.Data.OracleClient.OracleException E)
-            {
-                tx.Rollback();
-                throw new Exception(E.Message);
-            }
-        }
-
         /// <summary>
         /// 用于将string 的数组转换成SQL的查询内容
         /// </summary>
@@ -861,27 +420,13 @@ namespace DllService
             }
             return sql.Substring(0, sql.Length - 1);
         }
-        /// <summary>
-        /// 通过查询的内容获取到字段的描述
-        /// </summary>
-        /// <param name="field"></param>
-        /// <returns></returns>
-        private static string[] GetCaptionFromField(string field)
-        {
-            string[] caption = field.Split(',');
-            for (int i = 0; i < caption.Length; i++)
-            {
-                caption[i] = caption[i].Substring(0, caption[i].LastIndexOf("as")).Trim();
-            }
-            return caption;
-        }
 
         /// <summary>
         /// 通过查询的语句获取查询的字段
         /// </summary>
         /// <param name="field"></param>
         /// <returns></returns>
-        private static string[] GetField(string field)
+        private string[] GetField(string field)
         {
             string[] fields = field.Split(',');
             for (int i = 0; i < fields.Length; i++)
@@ -891,78 +436,6 @@ namespace DllService
             return fields;
         }
 
-        public object GetLabelParam(string sql)
-        {
-            DataTable dt = new DataTable();
-            command.CommandText = sql;
-            command.CommandType = CommandType.Text;
-            Reconnect(command);
-            OracleDataAdapter ad = new OracleDataAdapter();
-            ad.SelectCommand = command;
-            try
-            {
-                ad.Fill(dt);
-            }
-            catch (Exception)
-            {
-                connection = new OracleConnection(ConnectionStrings);
-                connection.Open();
-                command.Connection = connection;
-                ad = new OracleDataAdapter();
-                ad.SelectCommand = command;
-                ad.Fill(dt);
-            }
-            if (dt.Rows.Count > 0)
-            {
-                ad.Dispose();
-
-                return dt.Rows[0][0];
-            }
-            else
-            {
-                return "";
-            }
-        }
-
-        public static string[] GetParamFromSQL(string SQL)
-        {
-            string[] par = SQL.Split(':');
-            //用来存参数的数组
-            StringBuilder[] addpar = new StringBuilder[par.Length - 1];
-            string[] param = new string[par.Length - 1];
-            for (int i = 0; i < par.Length - 1; i++)
-            {
-                //新建一个char类型的数组用来存储每个字节的变量
-                char[] c = par[i + 1].ToCharArray();
-                addpar[i] = new StringBuilder();
-
-                for (int j = 0; j < c.Length; j++)
-                {
-                    if (c[j] != ' ' && c[j] != ',' && c[j] != ')')
-                    {
-                        addpar[i].Append(c[j]);
-                    }
-                    else
-                    {
-                        break;
-                    }
-                }
-            }
-            for (int i = 0; i < par.Length - 1; i++)
-            {
-                param[i] = addpar[i].ToString();
-            }
-            return param;
-        }
-
-        public void Dispose()
-        {
-            if (command != null)
-                command.Dispose();
-            if (connection != null)
-                connection.Dispose();
-        }
-
         private void Reconnect(OracleCommand cmd)
         {
             if (cmd.Connection.State == ConnectionState.Closed)

+ 435 - 99
UAS_MesInterface/MESHelper.cs

@@ -1,4 +1,5 @@
-using System;
+using Oracle.ManagedDataAccess.Client;
+using System;
 using System.Collections.Generic;
 using System.Data;
 using System.Runtime.InteropServices;
@@ -6,45 +7,44 @@ using System.Text;
 
 namespace DllService
 {
-    [Guid("7F13A2B7-3B59-4E44-BBB4-77744F2CA1E9")]
-    public interface DllService_Interface
+    [Guid("99D0E96E-1058-415D-9874-D34537625284")]
+    [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
+    public interface IMESHelper
     {
         [DispId(10)]
         bool CheckRoutePassed(string iSN, string iResCode, out string oErrMessage);
-        bool CheckUserLogin(string iUserCode, string iPassWord, out string oErrorMessage);
-        bool CheckUserAndResourcePassed(string iUserCode, string iResCode, out string oErrMessage);
-        bool SetIMEIInfo(string iSnCode, string iIMEI1, out string oErrMessage);
-        bool GetAddressRangeByMO(string iSN, out string oWIFI, out string oBT, out string oCode1, out string oCode2, out string oCdoe3, out string oErrMessage);
-        bool GetMEIOrNetCodeRange(string iSnCode, string iIMEI1, string iNetCode, out string oIMEI1, out string oIMEI2, out string oIMEI3, out string oMEID, out string oNetCode, out string oPSN, out string oID1, out string oID2, out string oID3, out string oID4, out string oID5, out string oErrMessage);
-        bool GetMobileAllInfo(string iSnCode, out string oWIFI, out string oBT, out string oCode1, out string oCode2, out string oCode3, out string oIMEI1, out string oIMEI2, out string oIMEI3, out string oMEID, out string oNetCode, out string oPSN, out string oID1, out string oID2, out string oID3, out string oID4, out string oID5, out string oErrorMessage);
         bool GetRcardMOInfo(string iSN, out string oMoCode, out string oErrMessage);
+        bool CheckUserAndResourcePassed(string iUserCode, string iResCode, string iPassWord,out string oErrMessage);
+        bool GetAddressRangeByMO(string iSN, out string oWIFI, out string oBT, out string oCode1, out string oCode2, out string oCdoe3, out string oErrMessage);
         bool SetAddressInfo(string iSN, string iWIFI, string iBT, string iCode1, string iCode2, string iCode3, out string oErrorMessage);
-        bool SetMobileData(string iSN, string iSourceCode, string iMPKind, string iResult, string iErrCode, out string oErrorMessage);
-        bool SetTestDetail(string iSN, string iClass, string iSubClass1, string iSubClass2, string iSubClass3, string iMaxValue, string iMinValue, string iActualValue, string iValue1, string iValue2, string iValue3, string iTestResult, out string oErrMessage);
-    }
-
-    [Guid("71E1A234-DB0D-44D0-8E30-28FD7B022DF6"),
-    InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
-    public interface DllService_Events
-    {
+        bool SetTestDetail(string iSN, string iClass, string iSubClass1, string iSubClass2, string iSubClass3, string iMaxValue, string iMinValue, string iActualValue, string iValue1, string iValue2, string iValue3, string iTestResult, string iResCode, out string oErrMessage);
+        bool GetMEIOrNetCodeRange(string iSnCode, string iIMEI1, string iNetCode, out string oIMEI1, out string oIMEI2, out string oMEID, out string oNetCode, out string oPSN, out string oID1, out string oID2, out string oID3, out string oID4, out string oID5, out string oErrMessage);
+        bool SetIMEIInfo(string iSnCode, string iIMEI1, out string oErrMessage);
+        bool GetMobileAllInfo(string iSnCode, out string oWIFI, out string oBT, out string oCode1, out string oCode2, out string oCode3, out string oIMEI1, out string oIMEI2, out string oMEID, out string oNetCode, out string oPSN, out string oID1, out string oID2, out string oID3, out string oID4, out string oID5, out string oErrorMessage);
+        bool SetMobileData(string iTSN, string iSN, string iSourceCode, string iMPKind, string iResult, string iErrCode, string flag, out string oErrorMessage);
     }
 
-    [Guid("C543093F-29A4-4DCF-85F4-C53FC2DB0EB2"),
-    ClassInterface(ClassInterfaceType.None),
-    ComSourceInterfaces(typeof(DllService_Events))]
-
-    public class MESHelper: DllService_Interface
+    [Guid("DF5132FE-EED9-40DB-8B43-9AE63420BCB5")]
+    [ClassInterface(ClassInterfaceType.None)]
+    [ComSourceInterfaces(typeof(IMESHelper))]
+    [ProgId("DllService.MESHelper")]
+    public class MESHelper : IMESHelper
     {
-        public MESHelper(string Environment)
-        {
-            dh = new DataHelper(Environment);
-        }
-
-        DataHelper dh;
         //用于拼接SQL
         StringBuilder sql = new StringBuilder();
         //用于存放批量执行的SQL
         List<string> sqls = new List<string>();
+        //系统默认的的连接字符串
+        private string ConnectionStrings = "Password=select!#%*(;User ID=MES_TEST;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=117.25.180.218)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
+        //用户选择的数据库的连接字符串
+        private OracleConnection connection = new OracleConnection("Password=select!#%*(;User ID=MES_TEST;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=117.25.180.218)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));");
+        //用户选择的数据库的连接字符串
+        private OracleCommand command = null;
+
+        public MESHelper()
+        {
+
+        }
 
         /// <summary>
         /// 检测当前的岗位资源对应的工序
@@ -57,7 +57,7 @@ namespace DllService
         {
             oErrMessage = "";
             string[] param = new string[] { "", iResCode, iSN, "", "", "", oErrMessage };
-            dh.CallProcedure("CS_CHECKSTEPSNANDMACODE", ref param);
+            CallProcedure("CS_CHECKSTEPSNANDMACODE", ref param);
             oErrMessage = param[6];
             if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
                 return true;
@@ -71,12 +71,12 @@ namespace DllService
         /// <param name="iUserCode"></param>
         /// <param name="oErrorMessage"></param>
         /// <returns></returns>
-        public bool CheckUserLogin(string iUserCode, string iPassWord, out string oErrorMessage)
+        private bool CheckUserLogin(string iUserCode, string iPassWord, out string oErrorMessage)
         {
             oErrorMessage = "";
             string SQL = "select em_code from employee where em_code=:UserName and em_password =:PassWord";
             DataTable dt;
-            dt = (DataTable)dh.ExecuteSql(SQL, "select", iUserCode, iPassWord);
+            dt = (DataTable)ExecuteSql(SQL, "select", iUserCode, iPassWord);
             if (dt.Rows.Count > 0)
                 return true;
             else
@@ -93,53 +93,56 @@ namespace DllService
         /// <param name="iResCode"></param>
         /// <param name="oErrMessage"></param>
         /// <returns></returns>
-        public bool CheckUserAndResourcePassed(string iUserCode, string iResCode, out string oErrMessage)
+        public bool CheckUserAndResourcePassed(string iUserCode, string iResCode, string iPassWord,out string oErrMessage)
         {
             oErrMessage = "";
-            string SQL = "select em_code,em_type,em_name from employee where em_code=:UserName ";
-            DataTable dt;
-            dt = (DataTable)dh.ExecuteSql(SQL, "select", iUserCode);
-            if (dt.Rows.Count > 0)
+            if (CheckUserLogin(iUserCode, iPassWord, out oErrMessage))
             {
-                string em_name = dt.Rows[0]["em_name"].ToString();
-                string em_type = dt.Rows[0]["em_type"].ToString();
-                if (iResCode == "")
-                {
-                    oErrMessage = "岗位资源不允许为空";
-                    return false;
-                }
-                if (em_type == "admin")
+                string SQL = "select em_code,em_type,em_name from employee where em_code=:UserName ";
+                DataTable dt;
+                dt = (DataTable)ExecuteSql(SQL, "select", iUserCode);
+                if (dt.Rows.Count > 0)
                 {
-                    if (dh.CheckExist("Source", "sc_code='" + iResCode + "' and sc_statuscode='AUDITED'"))
+                    string em_name = dt.Rows[0]["em_name"].ToString();
+                    string em_type = dt.Rows[0]["em_type"].ToString();
+                    if (iResCode == "")
                     {
-                        return true;
-                    }
-                    else
-                    {
-                        oErrMessage = "岗位资源编号错误或者未审核!";
+                        oErrMessage = "岗位资源不允许为空";
                         return false;
                     }
-                }
-                else
-                {
-                    dt = dh.getFieldsDatasByCondition("cs$empgroup left join cs$userresource on ur_groupcode=eg_groupcode left join source on ur_resourcecode=sc_code", new string[] { "ur_resourcecode" }, "eg_emcode = '" + iUserCode + "' and sc_statuscode='AUDITED'");
-                    //如果存在该编号
-                    if (dt.Rows.Count > 0)
+                    if (em_type == "admin")
                     {
-                        //判断如果多个岗位资源存在,用户输入的只要在其中就行
-                        for (int i = 0; i < dt.Rows.Count; i++)
+                        if (CheckExist("Source", "sc_code='" + iResCode + "' and sc_statuscode='AUDITED'"))
+                        {
+                            return true;
+                        }
+                        else
                         {
-                            if (dt.Rows[i]["ur_resourcecode"].ToString() == iResCode)
-                                return true;
+                            oErrMessage = "岗位资源编号错误或者未审核!";
+                            return false;
                         }
-                        oErrMessage = "用户不处于当前资源所属分组!";
                     }
                     else
-                        oErrMessage = "岗位资源编号错误或者未审核!";
+                    {
+                        dt = getFieldsDatasByCondition("cs$empgroup left join cs$userresource on ur_groupcode=eg_groupcode left join source on ur_resourcecode=sc_code", new string[] { "ur_resourcecode" }, "eg_emcode = '" + iUserCode + "' and sc_statuscode='AUDITED'");
+                        //如果存在该编号
+                        if (dt.Rows.Count > 0)
+                        {
+                            //判断如果多个岗位资源存在,用户输入的只要在其中就行
+                            for (int i = 0; i < dt.Rows.Count; i++)
+                            {
+                                if (dt.Rows[i]["ur_resourcecode"].ToString() == iResCode)
+                                    return true;
+                            }
+                            oErrMessage = "用户不处于当前资源所属分组!";
+                        }
+                        else
+                            oErrMessage = "岗位资源编号错误或者未审核!";
+                    }
                 }
+                else
+                    oErrMessage = "用户不存在!";
             }
-            else
-                oErrMessage = "用户不存在!";
             return false;
         }
 
@@ -165,7 +168,7 @@ namespace DllService
             string omakeCode = "";
             GetRcardMOInfo(iSN, out omakeCode, out oErrMessage);
             string[] param = new string[] { iSN, omakeCode, oWIFI, oBT, oCode1, oCode2, oCdoe3, oErrMessage };
-            dh.CallProcedure("CS_GETADDRESSBYMAKECODE", ref param);
+            CallProcedure("CS_GETADDRESSBYMAKECODE", ref param);
             oWIFI = param[2];
             oBT = param[3];
             oCode1 = param[4];
@@ -196,11 +199,10 @@ namespace DllService
         /// <param name="oID3"></param>
         /// <param name="oErrMessage"></param>
         /// <returns></returns>
-        public bool GetMEIOrNetCodeRange(string iSnCode, string iIMEI1, string iNetCode, out string oIMEI1, out string oIMEI2, out string oIMEI3, out string oMEID, out string oNetCode, out string oPSN, out string oID1, out string oID2, out string oID3, out string oID4, out string oID5, out string oErrMessage)
+        public bool GetMEIOrNetCodeRange(string iSnCode, string iIMEI1, string iNetCode, out string oIMEI1, out string oIMEI2, out string oMEID, out string oNetCode, out string oPSN, out string oID1, out string oID2, out string oID3, out string oID4, out string oID5, out string oErrMessage)
         {
             oIMEI1 = "";
             oIMEI2 = "";
-            oIMEI3 = "";
             oMEID = "";
             oNetCode = "";
             oPSN = "";
@@ -210,11 +212,10 @@ namespace DllService
             oID4 = "";
             oID5 = "";
             oErrMessage = "";
-            string[] param = new string[] { iSnCode, "", iIMEI1, iNetCode, oIMEI1, oIMEI2, oIMEI3, oMEID, oNetCode, oPSN, oID1, oID2, oID3, oErrMessage };
-            dh.CallProcedure("CS_GETIMEIORNETCODERANGE", ref param);
+            string[] param = new string[] { iSnCode, "", iIMEI1, iNetCode, oIMEI1, oIMEI2, "", oMEID, oNetCode, oPSN, oID1, oID2, oID3, oErrMessage };
+            CallProcedure("CS_GETIMEIORNETCODERANGE", ref param);
             oIMEI1 = param[4];
             oIMEI2 = param[5];
-            oIMEI3 = param[6];
             oMEID = param[7];
             oNetCode = param[8];
             oPSN = param[9];
@@ -240,8 +241,8 @@ namespace DllService
             //取MakeProcess表中的执行记录ID最大的一个工单的号码
             oMoCode = "";
             oErrMessage = "";
-            string ms_id = dh.getFieldDataByCondition("MakeSerial", "max(ms_id) ms_id", "ms_sncode='" + iSN + "' or ms_firstsn in (select firstsn from makesnrelation where sn='" + iSN + "')").ToString();
-            oMoCode = dh.getFieldDataByCondition("MakeSerial", "ms_makecode", "ms_id='" + ms_id + "'").ToString();
+            string ms_id = getFieldDataByCondition("MakeSerial", "max(ms_id) ms_id", "ms_sncode='" + iSN + "' or ms_firstsn in (select firstsn from makesnrelation where sn='" + iSN + "')").ToString();
+            oMoCode = getFieldDataByCondition("MakeSerial", "ms_makecode", "ms_id='" + ms_id + "'").ToString();
             if (oMoCode != "")
                 return true;
             else
@@ -254,7 +255,7 @@ namespace DllService
         /// <summary>
         /// 获取序列号的所有串号信息
         /// </summary>
-        /// <param name="iSnCode"></param>
+        /// <param name="iSN"></param>
         /// <param name="oWIFI"></param>
         /// <param name="oBT"></param>
         /// <param name="oCode1"></param>
@@ -273,7 +274,7 @@ namespace DllService
         /// <param name="oID5"></param>
         /// <param name="oErrorMessage"></param>
         /// <returns></returns>
-        public bool GetMobileAllInfo(string iSnCode, out string oWIFI, out string oBT, out string oCode1, out string oCode2, out string oCode3, out string oIMEI1, out string oIMEI2, out string oIMEI3, out string oMEID, out string oNetCode, out string oPSN, out string oID1, out string oID2, out string oID3, out string oID4, out string oID5, out string oErrorMessage)
+        public bool GetMobileAllInfo(string iSN, out string oWIFI, out string oBT, out string oCode1, out string oCode2, out string oCode3, out string oIMEI1, out string oIMEI2, out string oMEID, out string oNetCode, out string oPSN, out string oID1, out string oID2, out string oID3, out string oID4, out string oID5, out string oErrorMessage)
         {
             oBT = "";
             oMEID = "";
@@ -282,7 +283,6 @@ namespace DllService
             oNetCode = "";
             oIMEI1 = "";
             oIMEI2 = "";
-            oIMEI3 = "";
             oCode1 = "";
             oCode2 = "";
             oCode3 = "";
@@ -292,10 +292,10 @@ namespace DllService
             oID4 = "";
             oID5 = "";
             //通过序列号获取最近操作的工单号
-            string ms_id = dh.getFieldDataByCondition("makeserial", "ms_id", "ms_sncode='" + iSnCode + "'").ToString();
+            string ms_id = getFieldDataByCondition("makeserial", "ms_id", "ms_sncode='" + iSN + "'").ToString();
             if (ms_id != "")
             {
-                DataTable dt = dh.getFieldsDataByCondition("MakeSerial", new string[] { "ms_id", "ms_mac", "ms_bt", "ms_meid", "ms_netcode", "ms_psn", "ms_imei1", "ms_imei2", "ms_imei3", "ms_othcode1", "ms_othcode2", "ms_othcode3", "ms_othid1", "ms_othid2", "ms_othid3" }, "ms_id='" + ms_id + "'");
+                DataTable dt = getFieldsDataByCondition("MakeSerial", new string[] { "ms_id", "ms_mac", "ms_bt", "ms_meid", "ms_netcode", "ms_psn", "ms_imei1", "ms_imei2", "ms_imei3", "ms_othcode1", "ms_othcode2", "ms_othcode3", "ms_othid1", "ms_othid2", "ms_othid3" }, "ms_id='" + ms_id + "'");
                 if (dt.Rows.Count > 0)
                 {
                     oWIFI = dt.Rows[0]["ms_mac"].ToString();
@@ -305,7 +305,6 @@ namespace DllService
                     oMEID = dt.Rows[0]["ms_meid"].ToString();
                     oIMEI1 = dt.Rows[0]["ms_imei1"].ToString();
                     oIMEI2 = dt.Rows[0]["ms_imei2"].ToString();
-                    oIMEI3 = dt.Rows[0]["ms_imei3"].ToString();
                     oCode1 = dt.Rows[0]["ms_othcode1"].ToString();
                     oCode2 = dt.Rows[0]["ms_othcode2"].ToString();
                     oCode3 = dt.Rows[0]["ms_othcode3"].ToString();
@@ -317,13 +316,13 @@ namespace DllService
                 }
                 else
                 {
-                    oErrorMessage = "序列号" + iSnCode + "不存在";
+                    oErrorMessage = "序列号" + iSN + "不存在";
                     return false;
                 }
             }
             else
             {
-                oErrorMessage = "序列号" + iSnCode + "不存在";
+                oErrorMessage = "序列号" + iSN + "不存在";
                 return false;
             }
         }
@@ -349,7 +348,7 @@ namespace DllService
             sql.Append("ma_craftcode,ma_craftname,'" + iMPKind + "','" + result + "',sysdate,'" + iUserCode + "',ma_wccode,'" + LineCode + "','" + iSourceCode + "',");
             sql.Append("ms_status,ms_checkno,ms_outboxcode from make left join makeserial on ms_makecode=ma_code left join step on st_code=ms_stepcode ");
             sql.Append("where ms_sncode='" + iSnCode + "' and ma_code='" + iMakeCode + "' and st_code='" + CurrentStep + "'");
-            dh.ExecuteSql(sql.ToString(), "insert");
+            ExecuteSql(sql.ToString(), "insert");
         }
 
         /// <summary>
@@ -367,7 +366,7 @@ namespace DllService
         {
             oErrorMessage = "";
             string[] param = new string[] { iSN, iWIFI, iBT, iCode1, iCode2, iCode3, oErrorMessage };
-            dh.CallProcedure("CS_SETADDRESSINFO", ref param);
+            CallProcedure("CS_SETADDRESSINFO", ref param);
             oErrorMessage = param[6];
             if (oErrorMessage == "" || oErrorMessage == null || oErrorMessage == "null")
                 return true;
@@ -378,7 +377,7 @@ namespace DllService
         private bool SetStepFinish(string iMakeCode, string iSourceCode, string iSN, string iMPKind, string iResult, string iUserCode, string iErrCode, out string oErrorMessage)
         {
             oErrorMessage = "";
-            string StepCode = dh.getFieldDataByCondition("Makeserial", "ms_stepcode", "ms_sncode='" + iSN + "'").ToString();
+            string StepCode = getFieldDataByCondition("Makeserial", "ms_stepcode", "ms_sncode='" + iSN + "'").ToString();
             string CurrentStep = GetStepCodeBySource(iSourceCode);
             switch (iResult)
             {
@@ -399,9 +398,9 @@ namespace DllService
                         sql.Append(",ma_code,ms_code,ms_sncode,'" + iUserCode + "',sysdate,'" + StepCode + "',ms_sourcecode,:bc_code,'',");
                         sql.Append("sp_soncode,'0' from make left join makeSerial on ms_makecode=ma_code left join stepProduct on ");
                         sql.Append("sp_mothercode=ma_prodcode and sp_stepcode=ms_nextstepcode where ms_sncode='" + iSN + "'");
-                        dh.BatchInsert(sql.ToString(), new string[] { "bc_code" }, BadCode);
+                        BatchInsert(sql.ToString(), new string[] { "bc_code" }, BadCode);
                         //将不良的序列号的状态码设为3
-                        dh.ExecuteSql("update makeserial set ms_status='3' where ms_sncode=:sncode", "update", iSN);
+                        ExecuteSql("update makeserial set ms_status='3' where ms_sncode=:sncode", "update", iSN);
                     }
                     break;
                 default:
@@ -411,7 +410,7 @@ namespace DllService
 
             if (StepCode == CurrentStep && iResult == "OK")
             {
-                DataTable dt = dh.getFieldsDataByCondition("makeserial", new string[] { "ms_status", "ms_craftcode", "ms_prodcode" }, "ms_sncode='" + iSN + "'");
+                DataTable dt = getFieldsDataByCondition("makeserial", new string[] { "ms_status", "ms_craftcode", "ms_prodcode" }, "ms_sncode='" + iSN + "'");
                 if (dt.Rows.Count > 0)
                 {
                     string ms_status = dt.Rows[0]["ms_status"].ToString();
@@ -419,9 +418,9 @@ namespace DllService
                     string ms_prodcode = dt.Rows[0]["ms_prodcode"].ToString();
                     if (ms_status == "3")
                     {
-                        string nextstepcode = dh.getFieldDataByCondition("craft left join craftdetail on cr_id=cd_crid ", "cd_nextstepcode", "cr_code='" + ms_craftcode + "' and cr_prodcode='" + ms_prodcode + "' and cd_stepcode='" + CurrentStep + "'").ToString();
-                        dh.UpdateByCondition("makeserial", "ms_status=1,ms_nextstepcode='" + nextstepcode + "'", "ms_sncode='" + iSN + "'");
-                        dh.UpdateByCondition("makebad", "mb_status=-1", "mb_sncode='" + iSN + "'");
+                        string nextstepcode = getFieldDataByCondition("craft left join craftdetail on cr_id=cd_crid ", "cd_nextstepcode", "cr_code='" + ms_craftcode + "' and cr_prodcode='" + ms_prodcode + "' and cd_stepcode='" + CurrentStep + "'").ToString();
+                        UpdateByCondition("makeserial", "ms_status=1,ms_nextstepcode='" + nextstepcode + "'", "ms_sncode='" + iSN + "'");
+                        UpdateByCondition("makebad", "mb_status=-1", "mb_sncode='" + iSN + "'");
                     }
                 }
             }
@@ -439,7 +438,7 @@ namespace DllService
         /// <param name="iUserCode"></param>
         /// <param name="oErrorMessage"></param>
         /// <returns></returns>
-        public bool SetMobileData(string iSN, string iSourceCode, string iMPKind, string iResult, string iErrCode, out string oErrorMessage)
+        public bool SetMobileData(string iTSN, string iSN, string iSourceCode, string iMPKind, string iResult, string iErrCode, string flag, out string oErrorMessage)
         {
             string omakecode = "";
             GetRcardMOInfo(iSN, out omakecode, out oErrorMessage);
@@ -450,7 +449,7 @@ namespace DllService
         {
             oErrorMessage = "";
             string[] param = new string[] { iMakeCode, iSourceCode, iSN, iUserCode, iResult, oErrorMessage };
-            dh.CallProcedure("CS_SETSTEPRESULT", ref param);
+            CallProcedure("CS_SETSTEPRESULT", ref param);
             oErrorMessage = param[5];
             if (oErrorMessage == "" || oErrorMessage == null || oErrorMessage == "null")
                 return true;
@@ -475,7 +474,7 @@ namespace DllService
         /// <param name="iTestResult"></param>
         /// <param name="oErrMessage"></param>                                                      
         /// <returns></returns>
-        public bool SetTestDetail(string iSN, string iClass, string iSubClass1, string iSubClass2, string iSubClass3, string iMaxValue, string iMinValue, string iActualValue, string iValue1, string iValue2, string iValue3, string iTestResult, out string oErrMessage)
+        public bool SetTestDetail(string iSN, string iClass, string iSubClass1, string iSubClass2, string iSubClass3, string iMaxValue, string iMinValue, string iActualValue, string iValue1, string iValue2, string iValue3, string iTestResult, string iResCode, out string oErrMessage)
         {
             oErrMessage = "";
             sql.Clear();
@@ -483,10 +482,10 @@ namespace DllService
             GetRcardMOInfo(iSN, out omakeCode, out oErrMessage);
             sql.Append("Insert into STEPTESTDETAIL (STD_ID,STD_SN,STD_MAKECODE,STD_CLASS,STD_SUBCLASS1,STD_SUBCLASS2,");
             sql.Append("STD_SUBCLASS3,STD_MAXVALUE,STD_MINVALUE,STD_ACTUALVALUE,STD_VALUE1,STD_VALUE2,STD_VALUE3,STD_TESTRESULT,");
-            sql.Append("STD_DATE) values (STEPTESTDETAIL_SEQ.nextval,:std_sn,:std_makecode,");
+            sql.Append("STD_DATE,STD_RESCODE) values (STEPTESTDETAIL_SEQ.nextval,:std_sn,:std_makecode,");
             sql.Append(":std_class,:std_subclass1,:std_subclass2,:std_subclass3,:std_maxvalue,:std_minvalue,:std_actualvalue,:std_value1,");
-            sql.Append(":std_value2,:std_value3,:std_testresult,sysdate)");
-            dh.ExecuteSql(sql.ToString(), "select", iSN, omakeCode, iClass, iSubClass1, iSubClass2, iSubClass3, iMaxValue, iMinValue, iActualValue, iValue1, iValue2, iValue3, iTestResult);
+            sql.Append(":std_value2,:std_value3,:std_testresult,sysdate,:std_rescode)");
+            ExecuteSql(sql.ToString(), "select", iSN, omakeCode, iClass, iSubClass1, iSubClass2, iSubClass3, iMaxValue, iMinValue, iActualValue, iValue1, iValue2, iValue3, iTestResult, iResCode);
             return true;
         }
 
@@ -512,7 +511,7 @@ namespace DllService
         {
             oErrMessage = "";
             string[] param = new string[] { iSnCode, iIMEI1, "", "", "", "", "", "", "", "", oErrMessage };
-            dh.CallProcedure("CS_SETIMEIINFO", ref param);
+            CallProcedure("CS_SETIMEIINFO", ref param);
             oErrMessage = param[10];
             if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
                 return true;
@@ -529,7 +528,7 @@ namespace DllService
         /// <param name="LineCode"></param>
         private void GetStepCodeAndNameAndLineBySource(string Source, ref string StepCode, ref string StepName, ref string LineCode)
         {
-            DataTable dt = dh.getFieldsDataByCondition("source", new string[] { "sc_stepcode", "sc_stepname", "sc_linecode" }, "sc_code='" + Source + "'");
+            DataTable dt = getFieldsDataByCondition("source", new string[] { "sc_stepcode", "sc_stepname", "sc_linecode" }, "sc_code='" + Source + "'");
             if (dt.Rows.Count > 0)
             {
                 StepCode = dt.Rows[0]["sc_stepcode"].ToString();
@@ -546,7 +545,7 @@ namespace DllService
         /// <param name="StepName"></param>
         private void GetStepCodeAndNameBySource(string Source, ref string StepCode, ref string StepName)
         {
-            DataTable dt = dh.getFieldsDataByCondition("source", new string[] { "sc_stepcode", "sc_stepname", "sc_linecode" }, "sc_code='" + Source + "'");
+            DataTable dt = getFieldsDataByCondition("source", new string[] { "sc_stepcode", "sc_stepname", "sc_linecode" }, "sc_code='" + Source + "'");
             if (dt.Rows.Count > 0)
             {
                 StepCode = dt.Rows[0]["sc_stepcode"].ToString();
@@ -561,7 +560,344 @@ namespace DllService
         /// <returns></returns>
         private string GetStepCodeBySource(string Source)
         {
-            return dh.getFieldDataByCondition("source", "sc_stepcode", "sc_code='" + Source + "'").ToString();
+            return getFieldDataByCondition("source", "sc_stepcode", "sc_code='" + Source + "'").ToString();
+        }
+
+        /// <summary>
+        /// 获取第一行第一列的信息
+        /// </summary>
+        private object getFieldDataByCondition(string TableName, string Field, string Condition)
+        {
+            DataTable dt = new DataTable();
+            string sql = "select " + Field + " from " + TableName + " where " + Condition;
+            command = new OracleCommand(sql, connection);
+            Reconnect(command);
+            OracleDataAdapter ad = new OracleDataAdapter();
+            ad.SelectCommand = command;
+            try
+            {
+                ad.Fill(dt);
+            }
+            catch (Exception)
+            {
+                connection = new OracleConnection(ConnectionStrings);
+                connection.Open();
+                command = new OracleCommand(sql, connection);
+                ad = new OracleDataAdapter();
+                ad.SelectCommand = command;
+                ad.Fill(dt);
+            }
+            ad.Dispose();
+            command.Dispose();
+            if (dt.Rows.Count > 0)
+            {
+                return dt.Rows[0][0];
+            }
+            else
+            {
+                return "";
+            }
+        }
+
+        /// <summary>
+        /// 通过表名和获取单行的记录
+        /// </summary>
+        private DataTable getFieldsDataByCondition(string TableName, string[] Fields, string Condition)
+        {
+            DataTable dt = new DataTable();
+            string sql = "select ";
+            sql += AddField(Fields);
+            sql += " from " + TableName + " where " + Condition + " and rownum=1";
+            command = new OracleCommand(sql, connection);
+            Reconnect(command);
+            OracleDataAdapter ad = new OracleDataAdapter(command);
+            try
+            {
+                ad.Fill(dt);
+            }
+            catch (Exception)
+            {
+                connection = new OracleConnection(ConnectionStrings);
+                connection.Open();
+                command = new OracleCommand(sql, connection);
+                ad = new OracleDataAdapter();
+                ad.SelectCommand = command;
+                ad.Fill(dt);
+            }
+            ad.Dispose();
+            command.Dispose();
+            return dt;
+        }
+
+        /// <summary>
+        /// 通过表名,字段和条件获取DataTable类型的数据
+        /// </summary>
+        private DataTable getFieldsDatasByCondition(string TableName, string[] Fields, string Condition)
+        {
+            DataTable dt = new DataTable();
+            string sql = "select ";
+            sql += AddField(Fields);
+            sql += " from " + TableName + " where " + Condition;
+            command = new OracleCommand(sql, connection);
+            Reconnect(command);
+            OracleDataAdapter ad = new OracleDataAdapter(command);
+            try
+            {
+                ad.Fill(dt);
+            }
+            catch (Exception)
+            {
+                connection = new OracleConnection(ConnectionStrings);
+                connection.Open();
+                command = new OracleCommand(sql, connection);
+                ad = new OracleDataAdapter();
+                ad.SelectCommand = command;
+                ad.Fill(dt);
+            }
+            ad.Dispose();
+            command.Dispose();
+            return dt;
+        }
+
+        /// <summary>
+        /// 通过表名,字段获取DataTable类型的数据
+        /// </summary>
+        private DataTable getFieldsDatas(string TableName, string Fields)
+        {
+            DataTable dt = new DataTable();
+            string sql = "select ";
+            sql += Fields;
+            sql += " from " + TableName;
+            command = new OracleCommand(sql, connection);
+            Reconnect(command);
+            OracleDataAdapter ad = new OracleDataAdapter(command);
+            ad.SelectCommand = command;
+            try
+            {
+                ad.Fill(dt);
+            }
+            catch (Exception)
+            {
+                connection = new OracleConnection(ConnectionStrings);
+                connection.Open();
+                command = new OracleCommand(sql, connection);
+                ad = new OracleDataAdapter();
+                ad.SelectCommand = command;
+                ad.Fill(dt);
+            }
+            ad.Dispose();
+            command.Dispose();
+            return dt;
+        }
+
+        /// <summary>
+        /// 检测内容是否存在
+        /// </summary>
+        /// <param name="TableName"></param>
+        /// <param name="Condition"></param>
+        /// <returns></returns>
+        private bool CheckExist(string TableName, string Condition)
+        {
+            string sql = "select count(1) from " + TableName + " where " + Condition;
+            command = new OracleCommand(sql, connection);
+            Reconnect(command);
+            OracleDataAdapter ad = new OracleDataAdapter(command);
+            DataTable dt = new DataTable();
+            ad.Fill(dt);
+            ad.Dispose();
+            command.Dispose();
+            return int.Parse(dt.Rows[0][0].ToString()) > 0;
+        }
+
+        /// <summary>
+        /// 直接执行SQL,同时传入SQL的类型
+        /// </summary>
+        /// <param name="SQL"></param>
+        /// <param name="Type"></param>
+        /// <returns></returns>
+        private object ExecuteSql(string SQL, string Type, params object[] names)
+        {
+            object result = null;
+            command = new OracleCommand(SQL, connection);
+            Reconnect(command);
+            //用来拼接参数的
+            if (names.Length > 0)
+            {
+                string[] par = SQL.Split(':');
+                //用来存参数的数组
+                StringBuilder[] addpar = new StringBuilder[par.Length - 1];
+                for (int i = 0; i < par.Length - 1; i++)
+                {
+                    //新建一个char类型的数组用来存储每个字节的变量
+                    char[] c = par[i + 1].ToCharArray();
+                    addpar[i] = new StringBuilder();
+                    for (int j = 0; j < c.Length; j++)
+                    {
+                        if (c[j] != ' ' && c[j] != ',')
+                        {
+                            addpar[i].Append(c[j]);
+                        }
+                        else
+                        {
+                            break;
+                        }
+                    }
+                }
+                for (int i = 0; i < addpar.Length; i++)
+                    command.Parameters.Add(new OracleParameter(addpar[i].ToString(), OracleDbType.Varchar2, names[i], ParameterDirection.Input));
+            }
+            switch (Type.ToUpper())
+            {
+                case "SELECT":
+                    OracleDataAdapter ad = new OracleDataAdapter(command);
+                    result = new DataTable();
+                    try
+                    {
+                        ad.Fill((DataTable)result);
+                    }
+                    catch (Exception)
+                    {
+                        connection = new OracleConnection(ConnectionStrings);
+                        connection.Open();
+                        command = new OracleCommand(SQL, connection);
+                        ad = new OracleDataAdapter();
+                        ad.SelectCommand = command;
+                        ad.Fill((DataTable)result);
+                    }
+                    break;
+                case "DELETE":
+                    try
+                    {
+                        result = command.ExecuteNonQuery();
+                    }
+                    catch (Exception)
+                    {
+                        command.Connection = new OracleConnection(ConnectionStrings);
+                        command.Connection.Open();
+                        result = command.ExecuteNonQuery();
+                    }
+                    break;
+                case "UPDATE":
+                    try
+                    {
+                        result = command.ExecuteNonQuery();
+                    }
+                    catch (Exception)
+                    {
+                        command.Connection = new OracleConnection(ConnectionStrings);
+                        command.Connection.Open();
+                        result = command.ExecuteNonQuery();
+                    }
+                    break;
+                case "INSERT":
+                    try
+                    {
+                        result = command.ExecuteNonQuery();
+                    }
+                    catch (Exception)
+                    {
+                        command.Connection = new OracleConnection(ConnectionStrings);
+                        command.Connection.Open();
+                        result = command.ExecuteNonQuery();
+                    }
+                    break;
+            }
+            command.Dispose();
+            return result;
+        }
+
+        private void BatchInsert(string sql, params object[][] names)
+        {
+            command = new OracleCommand(sql, connection);
+            Reconnect(command);
+            command.ArrayBindCount = names[1].Length;
+            //因为第一个数组保存的是参数的名称,所以循环从1而不是0开始
+            //将第一个数组的下标固定为0作为循环添加的参数的名称
+            for (int i = 1; i <= names[0].Length; i++)
+            {
+                command.Parameters.Add(new OracleParameter(names[0][i - 1].ToString(), OracleDbType.Varchar2, names[i], ParameterDirection.Input));
+            }
+            try
+            {
+                command.ExecuteNonQuery();
+            }
+            catch (Exception)
+            {
+                command.Connection = new OracleConnection(ConnectionStrings);
+                command.Connection.Open();
+                command.ExecuteNonQuery();
+            }
+            command.Dispose();
+        }
+
+        private string UpdateByCondition(string TableName, string update, string condition)
+        {
+            string sql = "update " + TableName + " set " + update + " where " + condition;
+            command = new OracleCommand(sql, connection);
+            Reconnect(command);
+            try
+            {
+                command.ExecuteNonQuery();
+            }
+            catch (Exception)
+            {
+                command.Connection = new OracleConnection(ConnectionStrings);
+                command.Connection.Open();
+                command.ExecuteNonQuery();
+            }
+            command.Dispose();
+            return sql;
+        }
+
+        private void CallProcedure(string ProcedureName, ref string[] param)
+        {
+            command = new OracleCommand(ProcedureName);
+            command.Connection = connection;
+            Reconnect(command);
+            command.CommandText = ProcedureName;
+            command.CommandType = CommandType.StoredProcedure;
+            for (int i = 0; i < param.Length; i++)
+                command.Parameters.Add(new OracleParameter(param[i].ToString(), OracleDbType.Varchar2, 200, param[i], ParameterDirection.InputOutput));
+            try
+            {
+                command.ExecuteNonQuery();
+            }
+            catch (Exception)
+            {
+                command.Connection = new OracleConnection(ConnectionStrings);
+                command.Connection.Open();
+                command.ExecuteNonQuery();
+            }
+            for (int i = 0; i < command.Parameters.Count; i++)
+                param[i] = command.Parameters[i].Value.ToString();
+        }
+
+        private string AddField(string[] Fields)
+        {
+            string sql = " ";
+            foreach (string field in Fields)
+            {
+                sql += field + ",";
+            }
+            return sql.Substring(0, sql.Length - 1);
+        }
+
+        private string[] GetField(string field)
+        {
+            string[] fields = field.Split(',');
+            for (int i = 0; i < fields.Length; i++)
+            {
+                fields[i] = fields[i].Substring(fields[i].LastIndexOf("as") + 2, fields[i].Length - fields[i].LastIndexOf("as") - 2).Trim();
+            }
+            return fields;
+        }
+
+        private void Reconnect(OracleCommand cmd)
+        {
+            if (cmd.Connection.State == ConnectionState.Closed)
+            {
+                cmd.Connection.Open();
+            }
         }
     }
 }

+ 1 - 1
UAS_MesInterface/Properties/AssemblyInfo.cs

@@ -13,7 +13,7 @@ using System.Runtime.InteropServices;
 [assembly: AssemblyCopyright("Copyright ©  2017")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]
-[assembly: AssemblyKeyFile("DllService.snk")]
+[assembly: AssemblyKeyFile("key.snk")]
 //将 ComVisible 设置为 false 将使此程序集中的类型
 //对 COM 组件不可见。  如果需要从 COM 访问此程序集中的类型,
 //请将此类型的 ComVisible 特性设置为 true。

+ 2 - 4
UAS_MesInterface/UAS_MesDllService.csproj

@@ -35,7 +35,7 @@
     <SignAssembly>true</SignAssembly>
   </PropertyGroup>
   <PropertyGroup>
-    <AssemblyOriginatorKeyFile>bin\Debug\DllService.snk</AssemblyOriginatorKeyFile>
+    <AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>
   </PropertyGroup>
   <ItemGroup>
     <Reference Include="Oracle.ManagedDataAccess">
@@ -48,17 +48,15 @@
     <Reference Include="System.Data.DataSetExtensions" />
     <Reference Include="Microsoft.CSharp" />
     <Reference Include="System.Data" />
-    <Reference Include="System.Net.Http" />
     <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
-    <Compile Include="DataHelper.cs" />
     <Compile Include="MESHelper.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
   </ItemGroup>
   <ItemGroup>
     <None Include="bin\Debug\DllService.snk" />
-    <None Include="bin\Debug\MyCom.snk" />
+    <None Include="key.snk" />
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 

BIN
UAS_MesInterface/key.snk