瀏覽代碼

修改数据操作类,修改权限BUG

章政 8 年之前
父節點
當前提交
6713b0d36c

+ 63 - 271
UAS-MES/DataOperate/DataHelper.cs

@@ -27,10 +27,16 @@ namespace UAS_MES.DataOperate
             {
                 //如果选择的是默认数据则直接用配置文件的信息连接,否则选择数据库的账套信息
                 if (DBConnectionString == null || DBConnectionString == ConnectionStrings)
+                {
                     connection = new OracleConnection(ConnectionStrings);
+                }
                 else
+                {
                     connection = new OracleConnection(DBConnectionString);
+                }
                 connection.Open();
+                command = new OracleCommand();
+                command.Connection = connection;
             }
             catch (Exception e) { LogManager.DoLog(e.Message); }
         }
@@ -41,12 +47,12 @@ namespace UAS_MES.DataOperate
         public DataTable GetColumnDataType(string TableName)
         {
             DataTable dt = new DataTable();
-            command = new OracleCommand("select Column_Name,Data_Type from cols where TABLE_name=upper('" + TableName + "')", connection);
+            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();
-            command.Dispose();
             return dt;
         }
 
@@ -57,14 +63,13 @@ namespace UAS_MES.DataOperate
         {
             DataTable dt = new DataTable();
             string sql = "select " + Field + " from " + TableName + " where " + Condition;
-            
-            command = new OracleCommand(sql, connection);
+            command.CommandText = sql;
+            command.CommandType = CommandType.Text;
             Reconnect(command);
             OracleDataAdapter ad = new OracleDataAdapter();
             ad.SelectCommand = command;
             ad.Fill(dt);
             ad.Dispose();
-            command.Dispose();
             if (dt.Rows.Count > 0)
             {
                 return dt.Rows[0][0];
@@ -75,7 +80,6 @@ namespace UAS_MES.DataOperate
             }
         }
 
-
         /// <summary>
         /// 执行打印的SQL
         /// </summary>
@@ -95,18 +99,17 @@ namespace UAS_MES.DataOperate
                 {
                     sb.Append(Param[i] + ":Param" + i);
                 }
-                command = new OracleCommand(sb.ToString(), connection);
-
+                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();
-                command.Dispose();
+                command.Parameters.Clear();
                 return dt;
             }
             return "参数错误,请检查SQL语句";
@@ -120,13 +123,12 @@ namespace UAS_MES.DataOperate
         {
             DataTable dt = new DataTable();
             string sql = "select count(1) from " + TableName + " where " + Condition;
-            
-            command = new OracleCommand(sql, connection);
+            command.CommandText = sql;
+            command.CommandType = CommandType.Text;
             Reconnect(command);
             OracleDataAdapter ad = new OracleDataAdapter(command);
             ad.Fill(dt);
             ad.Dispose();
-            command.Dispose();
             return int.Parse(dt.Rows[0][0].ToString());
         }
 
@@ -139,13 +141,12 @@ namespace UAS_MES.DataOperate
         {
             DataTable dt = new DataTable();
             string sql = "select count(1) from " + TableName;
-            command = new OracleCommand(sql, connection);
+            command.CommandText = sql;
+            command.CommandType = CommandType.Text;
             Reconnect(command);
             OracleDataAdapter ad = new OracleDataAdapter(command);
-            
             ad.Fill(dt);
             ad.Dispose();
-            command.Dispose();
             return int.Parse(dt.Rows[0][0].ToString());
         }
 
@@ -158,32 +159,15 @@ namespace UAS_MES.DataOperate
             string sql = "select ";
             sql += AddField(Fields);
             sql += " from " + TableName + " where " + Condition + " and rownum=1";
-            
-            command = new OracleCommand(sql, connection);
+            command.CommandText = sql;
+            command.CommandType = CommandType.Text;
             Reconnect(command);
             OracleDataAdapter ad = new OracleDataAdapter(command);
             ad.Fill(dt);
             ad.Dispose();
-            command.Dispose();
             return dt;
         }
 
-        /// <summary>
-        /// 将DataTable导入到指定的表中
-        /// </summary>
-        /// <param name="DataTable"></param>
-        /// <param name="TableName"></param>
-        public void InsertDataTable(DataTable DataTable, string TableName)
-        {
-            for (int i = 0; i < DataTable.Rows.Count; i++)
-            {
-                for (int j = 0; j < DataTable.Columns.Count; j++)
-                {
-
-                }
-            }
-        }
-
         /// <summary>
         /// 按分页获取数据
         /// </summary>
@@ -212,12 +196,12 @@ namespace UAS_MES.DataOperate
                 else
                     sql.Append(" from " + TableName + ") A where ROWNUM <= " + CurrentPage * PageSize + ") where RN> " + (CurrentPage - 1) * PageSize);
             }
-            command = new OracleCommand(sql.ToString(), connection);
+            command.CommandText = sql.ToString();
+            command.CommandType = CommandType.Text;
             Reconnect(command);
             OracleDataAdapter ad = new OracleDataAdapter(command);
             ad.Fill(dt);
             ad.Dispose();
-            command.Dispose();
             dt.Columns.RemoveAt(0);
             foreach (DataColumn dc in dt.Columns)
             {
@@ -236,13 +220,12 @@ namespace UAS_MES.DataOperate
             string sql = "select ";
             sql += AddField(Fields);
             sql += " from " + TableName + " where " + Condition;
-            
-            command = new OracleCommand(sql, connection);
+            command.CommandText = sql;
+            command.CommandType = CommandType.Text;
             Reconnect(command);
             OracleDataAdapter ad = new OracleDataAdapter(command);
             ad.Fill(dt);
             ad.Dispose();
-            command.Dispose();
             return dt;
         }
 
@@ -255,7 +238,8 @@ namespace UAS_MES.DataOperate
             string sql = "select ";
             sql += Fields;
             sql += " from " + TableName;
-            command = new OracleCommand(sql, connection);
+            command.CommandText = sql;
+            command.CommandType = CommandType.Text;
             Reconnect(command);
             OracleDataAdapter ad = new OracleDataAdapter(command);
             ad.SelectCommand = command;
@@ -265,7 +249,6 @@ namespace UAS_MES.DataOperate
                 dc.Caption = "测试测试";
             }
             ad.Dispose();
-            command.Dispose();
             return dt;
         }
 
@@ -344,7 +327,6 @@ namespace UAS_MES.DataOperate
             //不是新增行的启用更新的方法
             sb.Append("update " + TableName + " set ");
             //拼接语句,特殊处理日期
-
             foreach (DataColumn dc in DataTable.Columns)
             {
                 if (!dc.DataType.ToString().Equals("System.DateTime"))
@@ -358,7 +340,8 @@ namespace UAS_MES.DataOperate
             }
             sb.Remove(sb.Length - 1, 1);
             sb.Append(" where " + PrimaryKey + "=:" + PrimaryKey);
-            command = new OracleCommand(sb.ToString(), connection);
+            command.CommandText = sb.ToString();
+            command.CommandType = CommandType.Text;
             OracleDataAdapter ad = new OracleDataAdapter(command);
             // 参数的长度是DataTable的行数决定的
             command.ArrayBindCount = DataTable.Rows.Count;
@@ -387,169 +370,7 @@ namespace UAS_MES.DataOperate
             ad.UpdateCommand = command;
             ad.Update(DataTable);
             ad.Dispose();
-            command.Dispose();
-        }
-
-        /// <summary>
-        /// 获取DbFind的数据的DataTable的结构
-        /// </summary>
-        /// <param name="field"></param>
-        /// <param name="caller"></param>
-        /// <returns></returns>
-        public DataTable GetDbFindDataTable(string field, string caller)
-        {
-            string sql = "select * from dbfindsetui where ds_caller='" + caller + "' and ds_whichui='" + field + "'";
-            DataTable dt = (DataTable)ExecuteSql(sql, "select");
-            if (dt.Rows.Count != 0)
-            {
-                //通过#号分割字段
-                string[] dbfield = dt.Rows[0]["ds_findtoui"].ToString().Split('#');
-                string[] cnfield = dt.Rows[0]["ds_dbcaption"].ToString().Split('#');
-                //获取查询要查询的Table
-                string dbtable = dt.Rows[0]["ds_tables"].ToString();
-                //拼接查询的字段
-                for (int i = 0; i < dbfield.Length; i++)
-                {
-                    dbfield[i] = dbfield[i].Split(',')[0];
-                }
-                //新建一个空的DataTable
-                DataTable dt1 = new DataTable();
-                //往空的DataTable添加结构,ColumnName是中文,Caption是实际的字段名称
-                for (int i = 0; i < cnfield.Length; i++)
-                {
-                    dt1.Columns.Add(cnfield[i]);
-                    dt1.Columns[i].Caption = dbfield[i];
-                }
-                //返回一个带有结构的空的DataTable
-                //DbFind.BindTable1 = dbtable;
-                return dt1;
-            }
-            else
-            {
-                return null;
-            }
-        }
-
-        /// <summary>
-        ///  获取配置列表中的数据,支持DaatList,Form,DetailGrid
-        /// </summary>
-        /// <param name="Caller"></param>
-        /// <param name="Type"></param>
-        /// <param name="condition"></param>
-        /// <returns></returns>
-        public DataTable GetConfigureData(string Caller, string Type, string condition)
-        {
-            DataTable dt = new DataTable();
-            //用于拼接SQL语句
-            StringBuilder Sql = new StringBuilder();
-            //用于设置不同Type时设置对应表的字段
-            string getField = "";
-            string getCaption = "";
-            string getTable = "";
-            switch (Type.ToUpper())
-            {
-                case "DATALIST":
-                    getField = "dld_field"; getCaption = "dld_caption"; getTable = "dld_table";
-                    Sql.Append("select * from datalistdetail where dld_caller='" + Caller + "'");
-                    break;
-                case "FORM":
-                    getField = "fd_field"; getCaption = "fd_caption"; getTable = "fd_table";
-                    Sql.Append("select * from formdetail where fd_foid=( select fo_id from form where fo_caller='" + Caller + "')");
-                    break;
-                case "DETAILGRID":
-                    getField = "dg_field"; getCaption = "dg_caption"; getTable = "dg_table";
-                    Sql.Append("select * from detailgrid  where dg_caller='" + Caller + "'");
-                    break;
-            }
-            command = new OracleCommand(Sql.ToString(), connection);
-            OracleDataAdapter ad = new OracleDataAdapter(command);
-            ad.Fill(dt);
-            //清除掉之前的内容重新拼接
-            Sql.Clear();
-            Sql.Append("select ");
-            string[] field = new string[dt.Rows.Count];
-            string[] caption = new string[dt.Rows.Count];
-            DataTable dt1 = new DataTable();
-            //记录描述和字段名称
-            foreach (DataRow dr in dt.Rows)
-            {
-                field[dt.Rows.IndexOf(dr)] = dr[getCaption].ToString();
-                caption[dt.Rows.IndexOf(dr)] = dr[getField].ToString();
-                Sql.Append(dr[getField] + ",");
-            }
-            //调用substring是为了去除之前拼接多出来的一个逗号
-            string sql = Sql.Remove(Sql.Length - 1, 1).ToString() + " from " + dt.Rows[0][getTable] + " where " + condition;
-            //调用一个新的构造DataTable用来存放返回的数据
-            dt1 = (DataTable)ExecuteSql(sql, "select");
-            //给DataTable加上列名和描述,列名是中文字段,描述是数据库实际的字段名称
-            for (int i = 0; i < field.Length; i++)
-            {
-                dt1.Columns[i].ColumnName = field[i];
-                dt1.Columns[i].Caption = caption[i];
-            }
-            //返回的第一条数据是SQL,后面的是实际的列名
-            ad.Dispose();
-            command.Dispose();
-            return dt1;
-        }
-
-        /// <summary>
-        /// 查询配置的字段,Type是查询DataList,Form还是DetailGrid
-        /// </summary>
-        /// <param name="Caller"></param>
-        /// <param name="Type"></param>
-        /// <returns></returns>
-        public DataTable GetConfigureData(string Caller, string Type)
-        {
-            DataTable dt = new DataTable();
-            //用于拼接SQL语句
-            StringBuilder Sql = new StringBuilder();
-            //用于设置不同Type时设置对应表的字段
-            string getField = "";
-            string getCaption = "";
-            string getTable = "";
-            switch (Type.ToUpper())
-            {
-                case "DATALIST":
-                    getField = "dld_field"; getCaption = "dld_caption"; getTable = "dld_table";
-                    Sql.Append("select * from datalistdetail where dld_caller='" + Caller + "'");
-                    break;
-                case "FORM":
-                    getField = "fd_field"; getCaption = "fd_caption"; getTable = "fd_table";
-                    Sql.Append("select * from formdetail where fd_foid=( select fo_id from form where fo_caller='" + Caller + "')");
-                    break;
-                case "DETAILGRID":
-                    getField = "dg_field"; getCaption = "dg_caption"; getTable = "dg_table";
-                    Sql.Append("select * from detailgrid  where dg_caller='" + Caller + "'");
-                    break;
-            }
-            command = new OracleCommand(Sql.ToString(), connection);
-            OracleDataAdapter ad = new OracleDataAdapter(command);
-            ad.Fill(dt);
-            //清除掉之前的内容重新拼接
-            Sql.Clear();
-            Sql.Append("select ");
-            //用于记录实际的列名,+1的目的是为了存放SQL
-            string[] field = new string[dt.Rows.Count];
-            string[] caption = new string[dt.Rows.Count];
-            DataTable dt1 = new DataTable();
-            foreach (DataRow dr in dt.Rows)
-            {
-                field[dt.Rows.IndexOf(dr)] = dr[getCaption].ToString();
-                caption[dt.Rows.IndexOf(dr)] = dr[getField].ToString();
-                Sql.Append(dr[getField] + ",");
-            }
-            string sql = Sql.Remove(Sql.Length - 1, 1).ToString() + " from " + dt.Rows[0][getTable];
-            dt1 = (DataTable)ExecuteSql(sql, "select");
-            //设置DataTable的列名和描述
-            for (int i = 0; i < field.Length; i++)
-            {
-                dt1.Columns[i].ColumnName = field[i];
-                dt1.Columns[i].Caption = caption[i];
-            }
-            ad.Dispose();
-            command.Dispose();
-            return dt1;
+            command.Parameters.Clear();
         }
 
         /// <summary>
@@ -561,14 +382,14 @@ namespace UAS_MES.DataOperate
         public bool CheckExist(string TableName, string Condition)
         {
             string sql = "select count(1) from " + TableName + " where " + Condition;
-            command = new OracleCommand(sql, connection);
+            command.CommandText = sql;
+            command.CommandType = CommandType.Text;
             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;
         }
 
@@ -581,7 +402,8 @@ namespace UAS_MES.DataOperate
         public object ExecuteSql(string SQL, string Type, params object[] names)
         {
             object result = null;
-            command = new OracleCommand(SQL, connection);
+            command.CommandText = SQL;
+            command.CommandType = CommandType.Text;
             Reconnect(command);
             //用来拼接参数的
             if (names.Length > 0)
@@ -609,29 +431,14 @@ namespace UAS_MES.DataOperate
                 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":
                     result = new DataTable();
-                    try
-                    {
-                        OracleDataAdapter ad = new OracleDataAdapter(command);
-                        ad.Fill((DataTable)result);
-                        ad.Dispose();
-                        //成功执行后将重复连接数置为0
-                        ReconnectTime = 0;
-                    }
-                    catch (Exception)
-                    {
-                        if (ReconnectTime == 0)
-                        {
-                            //重置的数据库链接后只执行一次
-                            ReconnectTime = ReconnectTime + 1;
-                            connection = new OracleConnection(DBConnectionString);
-                            result = ExecuteSql(SQL, Type, names);
-                        }
-                    }
+                    OracleDataAdapter ad = new OracleDataAdapter(command);
+                    ad.Fill((DataTable)result);
+                    ad.Dispose();
                     break;
                 case "DELETE":
                     result = command.ExecuteNonQuery();
@@ -643,33 +450,21 @@ namespace UAS_MES.DataOperate
                     result = command.ExecuteNonQuery();
                     break;
             }
-            command.Dispose();
+            command.Parameters.Clear();
             return result;
         }
 
-        /// <summary>
-        /// 为了同步BS端的条码维护,检测时允许问号的存在,在检测时默认将问号换成:Param参数
-        /// </summary>
-        /// <param name="SQL"></param>
-        public void CheckSQL(string SQL)
-        {
-            SQL = SQL.Replace("?", ":Param");
-            command = new OracleCommand(SQL, connection);
-            command.ExecuteNonQuery();
-            command.Dispose();
-        }
-
         public int GetDistinctRowCount(string TableName, string Field)
         {
             DataTable dt = new DataTable();
             string sql = "select distinct count('" + Field + "') from " + TableName;
-            
-            command = new OracleCommand(sql, connection);
+
+            command.CommandText = sql;
+            command.CommandType = CommandType.Text;
             Reconnect(command);
             OracleDataAdapter ad = new OracleDataAdapter(command);
             ad.Fill(dt);
             ad.Dispose();
-            command.Dispose();
             return int.Parse(dt.Rows[0][0].ToString());
         }
 
@@ -694,13 +489,14 @@ namespace UAS_MES.DataOperate
         public void DeleteDataByID(string TableName, string ID, string[] DeleteID)
         {
             string sql = "delete from " + TableName + " where " + ID + " =:DeleteID";
-            
-            command = new OracleCommand(sql, connection);
+
+            command.CommandText = sql;
+            command.CommandType = CommandType.Text;
             Reconnect(command);
             command.ArrayBindCount = DeleteID.Length;
             command.Parameters.Add(new OracleParameter("DeleteID", OracleDbType.Long, DeleteID, ParameterDirection.Input));
             command.ExecuteNonQuery();
-            command.Dispose();
+            command.Parameters.Clear();
         }
 
         /// <summary>
@@ -838,10 +634,11 @@ namespace UAS_MES.DataOperate
         /// <param name="names"></param>
         public void BatchInsert(string sql, params object[][] names)
         {
-            command = new OracleCommand(sql, connection);
+            command.CommandText = sql;
+            command.CommandType = CommandType.Text;
             Reconnect(command);
             command.ArrayBindCount = names[1].Length;
-            
+
             //因为第一个数组保存的是参数的名称,所以循环从1而不是0开始
             //将第一个数组的下标固定为0作为循环添加的参数的名称
             for (int i = 1; i <= names[0].Length; i++)
@@ -849,12 +646,13 @@ namespace UAS_MES.DataOperate
                 command.Parameters.Add(new OracleParameter(names[0][i - 1].ToString(), OracleDbType.Varchar2, names[i], ParameterDirection.Input));
             }
             command.ExecuteNonQuery();
-            command.Dispose();
+            command.Parameters.Clear();
         }
 
         public void BatchInsertDataTable(string sql, string[] param, params object[][] param1)
         {
-            command = new OracleCommand(sql, connection);
+            command.CommandText = sql;
+            command.CommandType = CommandType.Text;
             Reconnect(command);
             command.ArrayBindCount = param1[0].Length;
             //因为第一个数组保存的是参数的名称,所以循环从1而不是0开始
@@ -864,7 +662,7 @@ namespace UAS_MES.DataOperate
                 command.Parameters.Add(new OracleParameter(param[i].ToString(), OracleDbType.Varchar2, param1[i], ParameterDirection.Input));
             }
             command.ExecuteNonQuery();
-            command.Dispose();
+            command.Parameters.Clear();
         }
 
 
@@ -878,12 +676,12 @@ namespace UAS_MES.DataOperate
         {
             DataTable dt = new DataTable();
             string SQL = " select listagg(dld_field,',') within group (order by dld_id)  from datalistdetail where dld_caller='" + Caller + "'";
-            command = new OracleCommand(SQL, connection);
+            command.CommandText = SQL;
+            command.CommandType = CommandType.Text;
             Reconnect(command);
             OracleDataAdapter ad = new OracleDataAdapter(command);
             ad.Fill(dt);
             ad.Dispose();
-            command.Dispose();
             return dt.Rows[0][0].ToString();
         }
 
@@ -952,11 +750,11 @@ namespace UAS_MES.DataOperate
         public string UpdateByCondition(string TableName, string update, string condition)
         {
             string sql = "update " + TableName + " set " + update + " where " + condition;
-            
-            command = new OracleCommand(sql, connection);
+
+            command.CommandText = sql;
+            command.CommandType = CommandType.Text;
             Reconnect(command);
             command.ExecuteNonQuery();
-            command.Dispose();
             return sql;
         }
 
@@ -967,17 +765,15 @@ namespace UAS_MES.DataOperate
         /// <param name="param"></param>
         public void CallProcedure(string ProcedureName, ref string[] param)
         {
-            command = new OracleCommand(ProcedureName);
-            command.Connection = connection;
-            Reconnect(command);
             command.CommandText = ProcedureName;
+            Reconnect(command);
             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));
             command.ExecuteNonQuery();
             for (int i = 0; i < command.Parameters.Count; i++)
                 param[i] = command.Parameters[i].Value.ToString();
-            command.Dispose();
+            command.Parameters.Clear();
         }
 
         /// <summary>
@@ -987,16 +783,15 @@ namespace UAS_MES.DataOperate
         public void ExecuteSQLTran(params string[] SQL)
         {
             OracleTransaction tx = connection.BeginTransaction();
-            command = new OracleCommand();
-            command.Connection = connection;
             command.Transaction = tx;
+            command.CommandType = CommandType.Text;
             try
             {
                 foreach (string sql in SQL)
                 {
                     if (!String.IsNullOrEmpty(sql))
                     {
-                        
+
                         command.CommandText = sql;
                         command.ExecuteNonQuery();
                     }
@@ -1008,7 +803,6 @@ namespace UAS_MES.DataOperate
                 tx.Rollback();
                 throw new Exception(E.Message);
             }
-            command.Dispose();
         }
 
         /// <summary>
@@ -1058,7 +852,8 @@ namespace UAS_MES.DataOperate
         public object GetLabelParam(string sql)
         {
             DataTable dt = new DataTable();
-            command = new OracleCommand(sql, connection);
+            command.CommandText = sql;
+            command.CommandType = CommandType.Text;
             Reconnect(command);
             OracleDataAdapter ad = new OracleDataAdapter();
             ad.SelectCommand = command;
@@ -1066,12 +861,10 @@ namespace UAS_MES.DataOperate
             if (dt.Rows.Count > 0)
             {
                 ad.Dispose();
-                command.Dispose();
                 return dt.Rows[0][0];
             }
             else
             {
-                command.Dispose();
                 return "";
             }
         }
@@ -1087,7 +880,6 @@ namespace UAS_MES.DataOperate
                 //新建一个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] != ')')

+ 90 - 88
UAS-MES/FunctionCode/Employee/Employee_Group.Designer.cs

@@ -28,22 +28,22 @@
         /// </summary>
         private void InitializeComponent()
         {
+            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Employee_Group));
             System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
             System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
-            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Employee_Group));
             this.ug_code_label = new System.Windows.Forms.Label();
             this.ug_name_label = new System.Windows.Forms.Label();
             this.UserGroupDGV = new UAS_MES.CustomControl.DataGrid_View.DataGridViewWithSerialNum();
-            this.ug_id = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.ug_code = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.ug_name = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.UserSetting = new System.Windows.Forms.DataGridViewLinkColumn();
-            this.PowerSetting = new System.Windows.Forms.DataGridViewLinkColumn();
             this.NewGroup = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
             this.DeleteGroup = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
             this.Screen = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
-            this.ug_name1 = new UAS_MES.CustomControl.TextBoxWithIcon.SearchTextBox();
-            this.ug_code1 = new UAS_MES.CustomControl.TextBoxWithIcon.SearchTextBox();
+            this.ug_name = new UAS_MES.CustomControl.TextBoxWithIcon.SearchTextBox();
+            this.ug_code = new UAS_MES.CustomControl.TextBoxWithIcon.SearchTextBox();
+            this.ug_id = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.ug_code1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.ug_name1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.UserSetting = new System.Windows.Forms.DataGridViewLinkColumn();
+            this.PowerSetting = new System.Windows.Forms.DataGridViewLinkColumn();
             ((System.ComponentModel.ISupportInitialize)(this.UserGroupDGV)).BeginInit();
             this.SuspendLayout();
             // 
@@ -75,8 +75,8 @@
             this.UserGroupDGV.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
             this.UserGroupDGV.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
             this.ug_id,
-            this.ug_code,
-            this.ug_name,
+            this.ug_code1,
+            this.ug_name1,
             this.UserSetting,
             this.PowerSetting});
             this.UserGroupDGV.Location = new System.Drawing.Point(12, 71);
@@ -87,46 +87,6 @@
             this.UserGroupDGV.TabIndex = 244;
             this.UserGroupDGV.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.UserGroupDGV_CellClick);
             // 
-            // ug_id
-            // 
-            this.ug_id.DataPropertyName = "ug_id";
-            this.ug_id.HeaderText = "ug_id";
-            this.ug_id.Name = "ug_id";
-            this.ug_id.Visible = false;
-            // 
-            // ug_code
-            // 
-            this.ug_code.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
-            this.ug_code.DataPropertyName = "ug_code";
-            this.ug_code.HeaderText = "用户组代码";
-            this.ug_code.Name = "ug_code";
-            // 
-            // ug_name
-            // 
-            this.ug_name.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
-            this.ug_name.DataPropertyName = "ug_name";
-            this.ug_name.HeaderText = "用户组";
-            this.ug_name.Name = "ug_name";
-            // 
-            // UserSetting
-            // 
-            this.UserSetting.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
-            this.UserSetting.DataPropertyName = "UserSetting";
-            dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
-            this.UserSetting.DefaultCellStyle = dataGridViewCellStyle1;
-            this.UserSetting.HeaderText = "成员设置";
-            this.UserSetting.Name = "UserSetting";
-            this.UserSetting.Width = 120;
-            // 
-            // PowerSetting
-            // 
-            this.PowerSetting.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
-            this.PowerSetting.DataPropertyName = "PowerSetting";
-            dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
-            this.PowerSetting.DefaultCellStyle = dataGridViewCellStyle2;
-            this.PowerSetting.HeaderText = "权限分配";
-            this.PowerSetting.Name = "PowerSetting";
-            // 
             // NewGroup
             // 
             this.NewGroup.AllPower = null;
@@ -188,43 +148,85 @@
             this.Screen.UseVisualStyleBackColor = false;
             this.Screen.Click += new System.EventHandler(this.Screen_Click);
             // 
-            // ug_name1
+            // ug_name
             // 
-            this.ug_name1.AllPower = null;
-            this.ug_name1.Caller = null;
-            this.ug_name1.Condition = null;
-            this.ug_name1.DBTitle = null;
-            this.ug_name1.FormName = null;
-            this.ug_name1.Location = new System.Drawing.Point(443, 30);
-            this.ug_name1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
-            this.ug_name1.Name = "ug_name1";
-            this.ug_name1.Power = null;
-            this.ug_name1.SelectField = null;
-            this.ug_name1.SetValueField = null;
-            this.ug_name1.Size = new System.Drawing.Size(183, 26);
-            this.ug_name1.TabIndex = 240;
-            this.ug_name1.TableName = null;
-            this.ug_name1.Tag = "ug_code";
-            this.ug_name1.TextBoxEnable = true;
+            this.ug_name.AllPower = null;
+            this.ug_name.Caller = null;
+            this.ug_name.Condition = null;
+            this.ug_name.DBTitle = null;
+            this.ug_name.FormName = null;
+            this.ug_name.Location = new System.Drawing.Point(443, 30);
+            this.ug_name.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+            this.ug_name.Name = "ug_name";
+            this.ug_name.Power = null;
+            this.ug_name.ReturnData = null;
+            this.ug_name.SelectField = null;
+            this.ug_name.SetValueField = null;
+            this.ug_name.Size = new System.Drawing.Size(183, 26);
+            this.ug_name.TabIndex = 240;
+            this.ug_name.TableName = null;
+            this.ug_name.Tag = "ug_code";
+            this.ug_name.TextBoxEnable = true;
+            // 
+            // ug_code
+            // 
+            this.ug_code.AllPower = null;
+            this.ug_code.Caller = null;
+            this.ug_code.Condition = null;
+            this.ug_code.DBTitle = null;
+            this.ug_code.FormName = null;
+            this.ug_code.Location = new System.Drawing.Point(139, 30);
+            this.ug_code.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+            this.ug_code.Name = "ug_code";
+            this.ug_code.Power = null;
+            this.ug_code.ReturnData = null;
+            this.ug_code.SelectField = null;
+            this.ug_code.SetValueField = null;
+            this.ug_code.Size = new System.Drawing.Size(180, 26);
+            this.ug_code.TabIndex = 238;
+            this.ug_code.TableName = null;
+            this.ug_code.Tag = "ug_code";
+            this.ug_code.TextBoxEnable = true;
+            // 
+            // ug_id
+            // 
+            this.ug_id.DataPropertyName = "ug_id";
+            this.ug_id.HeaderText = "ug_id";
+            this.ug_id.Name = "ug_id";
+            this.ug_id.Visible = false;
             // 
             // ug_code1
             // 
-            this.ug_code1.AllPower = null;
-            this.ug_code1.Caller = null;
-            this.ug_code1.Condition = null;
-            this.ug_code1.DBTitle = null;
-            this.ug_code1.FormName = null;
-            this.ug_code1.Location = new System.Drawing.Point(139, 30);
-            this.ug_code1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+            this.ug_code1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
+            this.ug_code1.DataPropertyName = "ug_code";
+            this.ug_code1.HeaderText = "用户组代码";
             this.ug_code1.Name = "ug_code1";
-            this.ug_code1.Power = null;
-            this.ug_code1.SelectField = null;
-            this.ug_code1.SetValueField = null;
-            this.ug_code1.Size = new System.Drawing.Size(180, 26);
-            this.ug_code1.TabIndex = 238;
-            this.ug_code1.TableName = null;
-            this.ug_code1.Tag = "ug_code";
-            this.ug_code1.TextBoxEnable = true;
+            // 
+            // ug_name1
+            // 
+            this.ug_name1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
+            this.ug_name1.DataPropertyName = "ug_name";
+            this.ug_name1.HeaderText = "用户组";
+            this.ug_name1.Name = "ug_name1";
+            // 
+            // UserSetting
+            // 
+            this.UserSetting.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
+            this.UserSetting.DataPropertyName = "UserSetting";
+            dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
+            this.UserSetting.DefaultCellStyle = dataGridViewCellStyle1;
+            this.UserSetting.HeaderText = "成员设置";
+            this.UserSetting.Name = "UserSetting";
+            this.UserSetting.Width = 120;
+            // 
+            // PowerSetting
+            // 
+            this.PowerSetting.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
+            this.PowerSetting.DataPropertyName = "PowerSetting";
+            dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
+            this.PowerSetting.DefaultCellStyle = dataGridViewCellStyle2;
+            this.PowerSetting.HeaderText = "权限分配";
+            this.PowerSetting.Name = "PowerSetting";
             // 
             // Employee_Group
             // 
@@ -235,9 +237,9 @@
             this.Controls.Add(this.NewGroup);
             this.Controls.Add(this.DeleteGroup);
             this.Controls.Add(this.Screen);
-            this.Controls.Add(this.ug_name1);
+            this.Controls.Add(this.ug_name);
             this.Controls.Add(this.ug_name_label);
-            this.Controls.Add(this.ug_code1);
+            this.Controls.Add(this.ug_code);
             this.Controls.Add(this.ug_code_label);
             this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
             this.Margin = new System.Windows.Forms.Padding(4);
@@ -254,17 +256,17 @@
 
         #endregion
 
-        private CustomControl.TextBoxWithIcon.SearchTextBox ug_code1;
+        private CustomControl.TextBoxWithIcon.SearchTextBox ug_code;
         private System.Windows.Forms.Label ug_code_label;
-        private CustomControl.TextBoxWithIcon.SearchTextBox ug_name1;
+        private CustomControl.TextBoxWithIcon.SearchTextBox ug_name;
         private System.Windows.Forms.Label ug_name_label;
         private CustomControl.ButtonUtil.NormalButton Screen;
         private CustomControl.ButtonUtil.NormalButton DeleteGroup;
         private CustomControl.ButtonUtil.NormalButton NewGroup;
         private CustomControl.DataGrid_View.DataGridViewWithSerialNum UserGroupDGV;
         private System.Windows.Forms.DataGridViewTextBoxColumn ug_id;
-        private System.Windows.Forms.DataGridViewTextBoxColumn ug_code;
-        private System.Windows.Forms.DataGridViewTextBoxColumn ug_name;
+        private System.Windows.Forms.DataGridViewTextBoxColumn ug_code1;
+        private System.Windows.Forms.DataGridViewTextBoxColumn ug_name1;
         private System.Windows.Forms.DataGridViewLinkColumn UserSetting;
         private System.Windows.Forms.DataGridViewLinkColumn PowerSetting;
     }

+ 15 - 15
UAS-MES/FunctionCode/Employee/Employee_Group.cs

@@ -36,18 +36,18 @@ namespace UAS_MES.Employee
             dgvc.HeaderCell = ch1;
             this.UserGroupDGV.Columns.Insert(0, dgvc);
 
-            ug_code1.FormName = Name;
-            ug_code1.TableName = "CS$USERGROUP";
-            ug_code1.SelectField = "ug_code # 分组编号,ug_name # 分组名称,ug_inman # 录入人,ug_indate #录入日期";
-            ug_code1.SetValueField = new string[] { "ug_code1" };
+            ug_code.FormName = Name;
+            ug_code.TableName = "CS$USERGROUP";
+            ug_code.SelectField = "ug_code # 分组编号,ug_name # 分组名称,ug_inman # 录入人,ug_indate #录入日期";
+            ug_code.SetValueField = new string[] { "ug_code" };
 
-            ug_name1.FormName = Name;
-            ug_name1.TableName = "CS$USERGROUP";
-            ug_name1.SelectField = "ug_code # 分组编号,ug_name # 分组名称,ug_inman # 录入人,ug_indate #录入日期";
-            ug_name1.SetValueField = new string[] { "ug_name1" };
+            ug_name.FormName = Name;
+            ug_name.TableName = "CS$USERGROUP";
+            ug_name.SelectField = "ug_code # 分组编号,ug_name # 分组名称,ug_inman # 录入人,ug_indate #录入日期";
+            ug_name.SetValueField = new string[] { "ug_name" };
 
-            ug_code1.KeyDown += KeyDownEvent;
-            ug_name1.KeyDown += KeyDownEvent;
+            ug_code.KeyDown += KeyDownEvent;
+            ug_name.KeyDown += KeyDownEvent;
         }
 
         private void 人员分组_SizeChanged(object sender, EventArgs e)
@@ -57,7 +57,7 @@ namespace UAS_MES.Employee
 
         private void Screen_Click(object sender, EventArgs e)
         {
-            dt = (DataTable)dh.ExecuteSql("select ug_code,ug_id,ug_name,'查看组内成员' UserSetting,'权限分配' PowerSetting from cs$usergroup " + BaseUtil.GetScreenSqlCondition(ug_code1, ug_name1) + " order by ug_code", "select");
+            dt = (DataTable)dh.ExecuteSql("select ug_code,ug_id,ug_name,'查看组内成员' UserSetting,'权限分配' PowerSetting from cs$usergroup " + BaseUtil.GetScreenSqlCondition(ug_code, ug_name) + " order by ug_code", "select");
             BaseUtil.FillDgvWithDataTable(UserGroupDGV, dt);
         }
 
@@ -106,8 +106,8 @@ namespace UAS_MES.Employee
                     TabControl tc = (TabControl)this.Parent.Parent;
                     TabPage tb = new TabPage { Name = CallerUser, Tag = CallerUser, Text = "人员查看" };
                     tc.TabPages.Add(tb);
-                    string ug_code = UserGroupDGV.Rows[e.RowIndex].Cells["ug_code"].Value.ToString();
-                    string ug_name = UserGroupDGV.Rows[e.RowIndex].Cells["ug_name"].Value.ToString();
+                    string ug_code = UserGroupDGV.Rows[e.RowIndex].Cells["ug_code1"].Value.ToString();
+                    string ug_name = UserGroupDGV.Rows[e.RowIndex].Cells["ug_name1"].Value.ToString();
                     Employee_ChooseUserToGroup NewUser = new Employee_ChooseUserToGroup(ug_code, ug_name);
                     NewUser.TopLevel = false;
                     tc.SelectedTab = tb;
@@ -122,8 +122,8 @@ namespace UAS_MES.Employee
                     //如果窗体不存在进行打开
                     TabPage tb = new TabPage { Tag = CallerPower, Name = CallerPower, Text = "权限控制" };
                     tc.TabPages.Add(tb);
-                    string ug_code = UserGroupDGV.Rows[e.RowIndex].Cells["ug_code"].Value.ToString();
-                    string ug_name = UserGroupDGV.Rows[e.RowIndex].Cells["ug_name"].Value.ToString();
+                    string ug_code = UserGroupDGV.Rows[e.RowIndex].Cells["ug_code1"].Value.ToString();
+                    string ug_name = UserGroupDGV.Rows[e.RowIndex].Cells["ug_name1"].Value.ToString();
                     Employee_Power NewPower = new Employee_Power(ug_code, ug_name);
                     NewPower.TopLevel = false;
                     tc.SelectedTab = tb;

+ 2 - 2
UAS-MES/FunctionCode/Employee/Employee_Group.resx

@@ -120,10 +120,10 @@
   <metadata name="ug_id.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
-  <metadata name="ug_code.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+  <metadata name="ug_code1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
-  <metadata name="ug_name.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+  <metadata name="ug_name1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
   <metadata name="UserSetting.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">