Beispiel #1
0
        /// <summary>
        /// 运算-获取要生成的表体信息
        /// </summary>
        /// <param name="typeid">获取格式转换类型ID(0:格式转换 1:色母相关格式转换)</param>
        /// <param name="dt">从EXCEL导入的DT</param>
        /// <param name="tempdt">获取已运算成功的表头信息</param>
        /// <param name="comselectid"></param>
        /// <returns></returns>
        public DataTable GeneratetempEnpty(int typeid, DataTable dt, DataTable tempdt, int comselectid)
        {
            var resultdt = new DataTable();

            try
            {
                if (comselectid == 1)
                {
                    //获取对应临时表(表体)
                    resultdt = dtList.Get_genenptydt();
                    //循环获取已运算成功的表头信息
                    foreach (DataRow row in tempdt.Rows)
                    {
                        //根据表头的ID信息查询从EXCEL模板得出的DT内的相关内容
                        var rows = dt.Select("ID='" + Convert.ToInt32(row[0]) + "'");
                        //执行插入相关信息至临时表
                        resultdt.Merge(GenerColorantWeight(comselectid, typeid, resultdt, rows));
                    }
                }
                else
                {
                    //获取对应临时表(表体)
                    resultdt = dtList.Get_NewTempdtldt();
                    //循环获取已运算成功的表头信息
                    foreach (DataRow row in tempdt.Rows)
                    {
                        //根据表头的ID信息查询从EXCEL模板得出的DT内的相关内容
                        var rows = dt.Select("ID='" + Convert.ToInt32(row[0]) + "'");
                        //执行插入相关信息至临时表
                        resultdt.Merge(GenerColorantWeight(comselectid, typeid, resultdt, rows));
                    }
                }
            }
            catch (Exception)
            {
                resultdt.Rows.Clear();
                resultdt.Columns.Clear();
            }
            return(resultdt);
        }