using Aspose.Cells; using KGIS.Framework.DBOperator; using KGIS.Framework.Maps; using KGIS.Framework.Utils; using KGIS.Framework.Utils.ExtensionMethod; using KGIS.Framework.Utils.Helper; using Kingo.Plugin.BGResultManager.Model; using Kingo.PluginServiceInterface; using System; using System.Collections.Generic; using System.Data; using System.IO; using System.Xml; namespace Kingo.Plugin.BGResultManager.Utility { /// /// 盐田及工矿用地内部土地利用变化统计表 /// public class ExportYTJGKYDNBTDLYBHTJB { /// /// 执行导出 /// /// 保存位置 /// 获取年初表位置 /// 是否成功 public bool Export_SQL(string savePath, string baseReportPath, IRDBHelper dbHelper) { string ncsjExcelPath = string.Empty; try { if (string.IsNullOrWhiteSpace(savePath)) { MessageHelper.ShowError("存储位置错误请重试!"); return false; } string sourceFile = string.Empty; DirectoryInfo dir = new DirectoryInfo(baseReportPath); #region 数据赋值 string fileName = string.Empty; FileInfo[] fileSet = dir.GetFiles("(" + (MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).CODE + ")盐田及工矿用地内部土地利用*", SearchOption.AllDirectories); if (fileSet != null && fileSet.Length > 0) { ncsjExcelPath = fileSet[0].FullName; fileName = fileSet[0].Name.Replace("(", "").Replace(")", "").Replace((MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).CODE, "").Replace(fileSet[0].Extension, ""); } //else //{ // fileSet = dir.GetFiles("(" + (MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).CODE + ")盐田及工矿用地内部土地利用现状表.xls", SearchOption.AllDirectories); // if (fileSet != null && fileSet.Length > 0) // { // ncsjExcelPath = fileSet[0].FullName; // } //} if (String.IsNullOrWhiteSpace(ncsjExcelPath) == true) { return false; } string tempPath = AppDomain.CurrentDomain.BaseDirectory + "TempalateReports\\BGTJ\\工矿用地内部土地利用变化统计表.xlsx"; File.Copy(tempPath, savePath, true); DataTable resultdataTable = new DataTable(); DataTable dt = dbHelper.ExecuteDatatable("YTJGKYDNBTDLYBHTJB", @" select Cells_X,Cells_Y,BGMJ from ( select BGHDLBM , SUM(BGMJ) BGMJ from ( select substr(BGQDLBM, 1, 4) BGQDLBM, substr(BGQCZCSXM, 1, 3) BGQCZCSXM, substr(BGHDLBM, 1, 4) BGHDLBM,substr(BGHCZCSXM, 1, 3) BGHCZCSXM,BGMJ,XZQTZLX from JCTJB_GQ )A WHERE BGHCZCSXM='204' and (BGQDLBM<>BGHDLBM or BGQCZCSXM<>BGHCZCSXM) and XZQTZLX<>'2' GROUP BY BGHDLBM )A left join CSNBTDLYBHTJB B on a.BGHDLBM=b.bgh where B.Cells_X=8 UNION ALL select Cells_X,Cells_Y,BGMJ from ( select BGQDLBM,sum(BGMJ) BGMJ from ( select substr(BGQDLBM, 1, 4) BGQDLBM,substr(BGQCZCSXM, 1, 3) BGQCZCSXM, substr(BGHDLBM, 1, 4) BGHDLBM,substr(BGHCZCSXM, 1,3) BGHCZCSXM,BGMJ,XZQTZLX from JCTJB_GQ )A where BGQCZCSXM='204' and (BGQDLBM<>BGHDLBM or BGQCZCSXM<>BGHCZCSXM) and XZQTZLX<>'2' GROUP BY BGQDLBM )A left join CSNBTDLYBHTJB B on a.BGQDLBM=b.bgh where B.Cells_X=9 ", true); if (dt != null && dt.Rows.Count > 0) { resultdataTable.Merge(dt); } #endregion #region 上年末面积 DataTable table = dbHelper.ExecuteDatatable("tab", string.Format(@"select case WHEN column1='{0}' THEN'column1' ELSE 'column2' END ColumnName from {1} WHERE column1='{0}' or column2='{0}' ", (MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).CODE, fileName), true); if (table == null || table.Rows.Count == 0) { return false; } string ColumnName = table.Rows[0][0].ToTrim(); if (ColumnName == "column1") { dt = dbHelper.ExecuteDatatable("SNMMJ", string.Format(@" select '4' Cells_X, '1' Cells_Y, round(column2,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '2' Cells_Y, round(column3,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '3' Cells_Y, round(column4,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '4' Cells_Y, round(column5,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '5' Cells_Y, round(column6,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '6' Cells_Y, round(column7,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '7' Cells_Y, round(column8,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '8' Cells_Y, round(column9,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '9' Cells_Y, round(column10,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '10' Cells_Y, round(column11,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '11' Cells_Y, round(column12,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '12' Cells_Y, round(column13,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '13' Cells_Y, round(column14,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '14' Cells_Y, round(column15,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '15' Cells_Y, round(column16,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '16' Cells_Y, round(column17,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '17' Cells_Y, round(column18,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '18' Cells_Y, round(column19,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '19' Cells_Y, round(column20,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '20' Cells_Y, round(column21,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '21' Cells_Y, round(column22,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '22' Cells_Y, round(column23,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '23' Cells_Y, round(column24,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '24' Cells_Y, round(column25,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '25' Cells_Y, round(column26,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '26' Cells_Y, round(column27,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '27' Cells_Y, round(column28,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '28' Cells_Y, round(column29,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '29' Cells_Y, round(column30,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '30' Cells_Y, round(column31,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '31' Cells_Y, round(column32,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '32' Cells_Y, round(column33,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '33' Cells_Y, round(column34,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '34' Cells_Y, round(column35,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '35' Cells_Y, round(column36,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '36' Cells_Y, round(column37,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '37' Cells_Y, round(column38,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '38' Cells_Y, round(column39,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '39' Cells_Y, round(column40,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '40' Cells_Y, round(column41,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '41' Cells_Y, round(column42,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '42' Cells_Y, round(column43,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '43' Cells_Y, round(column44,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '44' Cells_Y, round(column45,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '45' Cells_Y, round(column46,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '46' Cells_Y, round(column47,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '47' Cells_Y, round(column48,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '48' Cells_Y, round(column49,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '49' Cells_Y, round(column50,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '50' Cells_Y, round(column51,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '51' Cells_Y, round(column52,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '52' Cells_Y, round(column53,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '53' Cells_Y, round(column54,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '54' Cells_Y, round(column55,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '55' Cells_Y, round(column56,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '56' Cells_Y, round(column57,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '57' Cells_Y, round(column58,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '58' Cells_Y, round(column59,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '59' Cells_Y, round(column60,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '60' Cells_Y, round(column61,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '61' Cells_Y, round(column62,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '62' Cells_Y, round(column63,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '63' Cells_Y, round(column64,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '64' Cells_Y, round(column65,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '65' Cells_Y, round(column66,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '66' Cells_Y, round(column67,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '67' Cells_Y, round(column68,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '68' Cells_Y, round(column69,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '69' Cells_Y, round(column70,4) BGMJ from {2} WHERE {1}='{0}' ", (MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).CODE, ColumnName, fileName), true); } else if (ColumnName == "column2") { dt = dbHelper.ExecuteDatatable("SNMMJ", string.Format(@" select '4' Cells_X, '1' Cells_Y, round(column3,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '2' Cells_Y, round(column4,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '3' Cells_Y, round(column5,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '4' Cells_Y, round(column6,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '5' Cells_Y, round(column7,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '6' Cells_Y, round(column8,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '7' Cells_Y, round(column9,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '8' Cells_Y, round(column10,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '9' Cells_Y, round(column11,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '10' Cells_Y, round(column12,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '11' Cells_Y, round(column13,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '12' Cells_Y, round(column14,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '13' Cells_Y, round(column15,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '14' Cells_Y, round(column16,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '15' Cells_Y, round(column17,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '16' Cells_Y, round(column18,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '17' Cells_Y, round(column19,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '18' Cells_Y, round(column20,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '19' Cells_Y, round(column21,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '20' Cells_Y, round(column22,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '21' Cells_Y, round(column23,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '22' Cells_Y, round(column24,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '23' Cells_Y, round(column25,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '24' Cells_Y, round(column26,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '25' Cells_Y, round(column27,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '26' Cells_Y, round(column28,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '27' Cells_Y, round(column29,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '28' Cells_Y, round(column30,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '29' Cells_Y, round(column31,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '30' Cells_Y, round(column32,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '31' Cells_Y, round(column33,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '32' Cells_Y, round(column34,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '33' Cells_Y, round(column35,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '34' Cells_Y, round(column36,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '35' Cells_Y, round(column37,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '36' Cells_Y, round(column38,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '37' Cells_Y, round(column39,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '38' Cells_Y, round(column40,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '39' Cells_Y, round(column41,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '40' Cells_Y, round(column42,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '41' Cells_Y, round(column43,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '42' Cells_Y, round(column44,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '43' Cells_Y, round(column45,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '44' Cells_Y, round(column46,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '45' Cells_Y, round(column47,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '46' Cells_Y, round(column48,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '47' Cells_Y, round(column49,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '48' Cells_Y, round(column50,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '49' Cells_Y, round(column51,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '50' Cells_Y, round(column52,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '51' Cells_Y, round(column53,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '52' Cells_Y, round(column54,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '53' Cells_Y, round(column55,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '54' Cells_Y, round(column56,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '55' Cells_Y, round(column57,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '56' Cells_Y, round(column58,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '57' Cells_Y, round(column59,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '58' Cells_Y, round(column60,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '59' Cells_Y, round(column61,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '60' Cells_Y, round(column62,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '61' Cells_Y, round(column63,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '62' Cells_Y, round(column64,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '63' Cells_Y, round(column65,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '64' Cells_Y, round(column66,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '65' Cells_Y, round(column67,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '66' Cells_Y, round(column68,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '67' Cells_Y, round(column69,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '68' Cells_Y, round(column70,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '69' Cells_Y, round(column71,4) BGMJ from {2} WHERE {1}='{0}' ", (MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).CODE, ColumnName, fileName), true); } if (dt != null && dt.Rows.Count > 0) { resultdataTable.Merge(dt); } #endregion #region 行政区调入 dt = dbHelper.ExecuteDatatable("XZQDR", string.Format(@"select Cells_X,Cells_Y,BGMJ from ( select DLBM, SUM(BGMJ) BGMJ from ( select case when XZQTZLX='1' THEN BGQCZCSXM else BGHCZCSXM END CZCSXM,BGMJ,case when XZQTZLX='1' THEN BGQDLBM else BGHDLBM END DLBM from ( select substr(BGQDLBM, 1, 4) BGQDLBM, substr(BGQCZCSXM, 1, 3) BGQCZCSXM, substr(BGHDLBM, 1, 4) BGHDLBM,substr(BGHCZCSXM, 1, 3) BGHCZCSXM,BGMJ,XZQTZLX from JCTJB_GQ where XZQTZLX in ('1','3') )A )A WHERE CZCSXM='204' GROUP BY DLBM )A left join CSNBTDLYBHTJB B on a.DLBM=b.bgh where B.Cells_X=5 "), true); if (dt != null && dt.Rows.Count > 0) { resultdataTable.Merge(dt); } #endregion #region 行政区调出 dt = dbHelper.ExecuteDatatable("XZQDC", string.Format(@"select Cells_X,Cells_Y,BGMJ from ( select BGQDLBM,sum(BGMJ) BGMJ from ( select substr(BGQDLBM, 1, 4) BGQDLBM,substr(BGQCZCSXM, 1, 3) BGQCZCSXM, substr(BGHDLBM, 1, 4) BGHDLBM,substr(BGHCZCSXM, 1,3) BGHCZCSXM,BGMJ from JCTJB_GQ where XZQTZLX in ('2','4') )A where BGQCZCSXM='204' and (BGQDLBM<>BGHDLBM or BGQCZCSXM<>BGHCZCSXM) GROUP BY BGQDLBM )A left join CSNBTDLYBHTJB B on a.BGQDLBM=b.bgh where B.Cells_X=6 "), true); if (dt != null && dt.Rows.Count > 0) { resultdataTable.Merge(dt); } CellHelper.SetFileToDisk(resultdataTable, savePath, 0); #endregion CellHelper.Import(savePath); return true; } catch (Exception e) { throw e; } finally { } } public BBPCModel Export_SQL(string savePath, string baseReportPath, IRDBHelper dbHelper, ref List pcModelList) { string ncsjExcelPath = string.Empty; BBPCModel result = null; string fileName = string.Empty; try { if (string.IsNullOrWhiteSpace(savePath)) { MessageHelper.ShowError("存储位置错误请重试!"); return result; } string sourceFile = string.Empty; DirectoryInfo dir = new DirectoryInfo(baseReportPath); #region 数据赋值 FileInfo[] fileSet = dir.GetFiles("(" + (MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).CODE + ")盐田及工矿用地内部土地利用*", SearchOption.AllDirectories); if (fileSet != null && fileSet.Length > 0) { ncsjExcelPath = fileSet[0].FullName; fileName = fileSet[0].Name.Replace("(", "").Replace(")", "").Replace((MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).CODE, "").Replace(fileSet[0].Extension, ""); } //else //{ // fileSet = dir.GetFiles("(" + (MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).CODE + ")盐田及工矿用地内部土地利用现状表.xls", SearchOption.AllDirectories); // if (fileSet != null && fileSet.Length > 0) // { // ncsjExcelPath = fileSet[0].FullName; // } //} if (String.IsNullOrWhiteSpace(ncsjExcelPath) == true) { return result; } string tempPath = AppDomain.CurrentDomain.BaseDirectory + "TempalateReports\\BGTJ\\工矿用地内部土地利用变化统计表.xlsx"; savePath = savePath + "\\工矿用地内部土地利用变化统计表.xlsx"; File.Copy(tempPath, savePath, true); DataTable resultdataTable = new DataTable(); DataTable dt = dbHelper.ExecuteDatatable("YTJGKYDNBTDLYBHTJB", @" select Cells_X,Cells_Y,BGMJ from ( select BGHDLBM , SUM(BGMJ) BGMJ from ( select substr(BGQDLBM, 1, 4) BGQDLBM, substr(BGQCZCSXM, 1, 3) BGQCZCSXM, substr(BGHDLBM, 1, 4) BGHDLBM,substr(BGHCZCSXM, 1, 3) BGHCZCSXM,BGMJ,XZQTZLX from JCTJB_GQ where XZQTZLX not in ('1','2','3','4') )A WHERE BGHCZCSXM='204' and (BGQDLBM<>BGHDLBM or BGQCZCSXM<>BGHCZCSXM) GROUP BY BGHDLBM )A left join CSNBTDLYBHTJB B on a.BGHDLBM=b.bgh where B.Cells_X=8 UNION ALL select Cells_X,Cells_Y,BGMJ from ( select BGQDLBM,sum(BGMJ) BGMJ from ( select substr(BGQDLBM, 1, 4) BGQDLBM,substr(BGQCZCSXM, 1, 3) BGQCZCSXM, substr(BGHDLBM, 1, 4) BGHDLBM,substr(BGHCZCSXM, 1,3) BGHCZCSXM,BGMJ from JCTJB_GQ where XZQTZLX not in ('1','2','3','4') )A where BGQCZCSXM='204' and (BGQDLBM<>BGHDLBM or BGQCZCSXM<>BGHCZCSXM) GROUP BY BGQDLBM )A left join CSNBTDLYBHTJB B on a.BGQDLBM=b.bgh where B.Cells_X=9 ", true); if (dt != null && dt.Rows.Count > 0) { resultdataTable.Merge(dt); } #endregion #region 上年末面积 DataTable table = dbHelper.ExecuteDatatable("tab", string.Format(@"select case WHEN column1='{0}' THEN'column1' ELSE 'column2' END ColumnName from {1} WHERE column1='{0}' or column2='{0}' ", (MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).CODE, fileName), true); if (table == null || table.Rows.Count == 0) { return result; } string ColumnName = table.Rows[0][0].ToTrim(); if (ColumnName == "column1") { dt = dbHelper.ExecuteDatatable("SNMMJ", string.Format(@" select '4' Cells_X, '1' Cells_Y, round(column2,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '2' Cells_Y, round(column3,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '3' Cells_Y, round(column4,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '4' Cells_Y, round(column5,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '5' Cells_Y, round(column6,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '6' Cells_Y, round(column7,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '7' Cells_Y, round(column8,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '8' Cells_Y, round(column9,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '9' Cells_Y, round(column10,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '10' Cells_Y, round(column11,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '11' Cells_Y, round(column12,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '12' Cells_Y, round(column13,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '13' Cells_Y, round(column14,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '14' Cells_Y, round(column15,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '15' Cells_Y, round(column16,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '16' Cells_Y, round(column17,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '17' Cells_Y, round(column18,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '18' Cells_Y, round(column19,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '19' Cells_Y, round(column20,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '20' Cells_Y, round(column21,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '21' Cells_Y, round(column22,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '22' Cells_Y, round(column23,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '23' Cells_Y, round(column24,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '24' Cells_Y, round(column25,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '25' Cells_Y, round(column26,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '26' Cells_Y, round(column27,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '27' Cells_Y, round(column28,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '28' Cells_Y, round(column29,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '29' Cells_Y, round(column30,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '30' Cells_Y, round(column31,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '31' Cells_Y, round(column32,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '32' Cells_Y, round(column33,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '33' Cells_Y, round(column34,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '34' Cells_Y, round(column35,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '35' Cells_Y, round(column36,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '36' Cells_Y, round(column37,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '37' Cells_Y, round(column38,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '38' Cells_Y, round(column39,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '39' Cells_Y, round(column40,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '40' Cells_Y, round(column41,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '41' Cells_Y, round(column42,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '42' Cells_Y, round(column43,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '43' Cells_Y, round(column44,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '44' Cells_Y, round(column45,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '45' Cells_Y, round(column46,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '46' Cells_Y, round(column47,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '47' Cells_Y, round(column48,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '48' Cells_Y, round(column49,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '49' Cells_Y, round(column50,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '50' Cells_Y, round(column51,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '51' Cells_Y, round(column52,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '52' Cells_Y, round(column53,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '53' Cells_Y, round(column54,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '54' Cells_Y, round(column55,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '55' Cells_Y, round(column56,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '56' Cells_Y, round(column57,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '57' Cells_Y, round(column58,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '58' Cells_Y, round(column59,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '59' Cells_Y, round(column60,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '60' Cells_Y, round(column61,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '61' Cells_Y, round(column62,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '62' Cells_Y, round(column63,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '63' Cells_Y, round(column64,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '64' Cells_Y, round(column65,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '65' Cells_Y, round(column66,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '66' Cells_Y, round(column67,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '67' Cells_Y, round(column68,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '68' Cells_Y, round(column69,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '69' Cells_Y, round(column70,4) BGMJ from {2} WHERE {1}='{0}' ", (MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).CODE, ColumnName, fileName), true); } else if (ColumnName == "column2") { dt = dbHelper.ExecuteDatatable("SNMMJ", string.Format(@" select '4' Cells_X, '1' Cells_Y, round(column3,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '2' Cells_Y, round(column4,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '3' Cells_Y, round(column5,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '4' Cells_Y, round(column6,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '5' Cells_Y, round(column7,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '6' Cells_Y, round(column8,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '7' Cells_Y, round(column9,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '8' Cells_Y, round(column10,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '9' Cells_Y, round(column11,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '10' Cells_Y, round(column12,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '11' Cells_Y, round(column13,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '12' Cells_Y, round(column14,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '13' Cells_Y, round(column15,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '14' Cells_Y, round(column16,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '15' Cells_Y, round(column17,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '16' Cells_Y, round(column18,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '17' Cells_Y, round(column19,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '18' Cells_Y, round(column20,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '19' Cells_Y, round(column21,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '20' Cells_Y, round(column22,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '21' Cells_Y, round(column23,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '22' Cells_Y, round(column24,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '23' Cells_Y, round(column25,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '24' Cells_Y, round(column26,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '25' Cells_Y, round(column27,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '26' Cells_Y, round(column28,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '27' Cells_Y, round(column29,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '28' Cells_Y, round(column30,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '29' Cells_Y, round(column31,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '30' Cells_Y, round(column32,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '31' Cells_Y, round(column33,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '32' Cells_Y, round(column34,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '33' Cells_Y, round(column35,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '34' Cells_Y, round(column36,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '35' Cells_Y, round(column37,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '36' Cells_Y, round(column38,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '37' Cells_Y, round(column39,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '38' Cells_Y, round(column40,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '39' Cells_Y, round(column41,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '40' Cells_Y, round(column42,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '41' Cells_Y, round(column43,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '42' Cells_Y, round(column44,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '43' Cells_Y, round(column45,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '44' Cells_Y, round(column46,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '45' Cells_Y, round(column47,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '46' Cells_Y, round(column48,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '47' Cells_Y, round(column49,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '48' Cells_Y, round(column50,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '49' Cells_Y, round(column51,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '50' Cells_Y, round(column52,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '51' Cells_Y, round(column53,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '52' Cells_Y, round(column54,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '53' Cells_Y, round(column55,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '54' Cells_Y, round(column56,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '55' Cells_Y, round(column57,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '56' Cells_Y, round(column58,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '57' Cells_Y, round(column59,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '58' Cells_Y, round(column60,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '59' Cells_Y, round(column61,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '60' Cells_Y, round(column62,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '61' Cells_Y, round(column63,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '62' Cells_Y, round(column64,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '63' Cells_Y, round(column65,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '64' Cells_Y, round(column66,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '65' Cells_Y, round(column67,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '66' Cells_Y, round(column68,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '67' Cells_Y, round(column69,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '68' Cells_Y, round(column70,4) BGMJ from {2} WHERE {1}='{0}' union ALL select '4' Cells_X, '69' Cells_Y, round(column71,4) BGMJ from {2} WHERE {1}='{0}' ", (MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).CODE, ColumnName, fileName), true); } if (dt != null && dt.Rows.Count > 0) { resultdataTable.Merge(dt); } #endregion #region 行政区调入 dt = dbHelper.ExecuteDatatable("XZQDR", string.Format(@"select Cells_X,Cells_Y,BGMJ from ( select DLBM, SUM(BGMJ) BGMJ from ( select case when XZQTZLX='1' THEN BGQCZCSXM else BGHCZCSXM END CZCSXM,BGMJ,case when XZQTZLX='1' THEN BGQDLBM else BGHDLBM END DLBM from ( select substr(BGQDLBM, 1, 4) BGQDLBM, substr(BGQCZCSXM, 1, 3) BGQCZCSXM, substr(BGHDLBM, 1, 4) BGHDLBM,substr(BGHCZCSXM, 1, 3) BGHCZCSXM,BGMJ,XZQTZLX from JCTJB_GQ where XZQTZLX in ('1','3') )A )A WHERE CZCSXM='204' GROUP BY DLBM )A left join CSNBTDLYBHTJB B on a.DLBM=b.bgh where B.Cells_X=5 "), true); if (dt != null && dt.Rows.Count > 0) { resultdataTable.Merge(dt); } #endregion #region 行政区调出 dt = dbHelper.ExecuteDatatable("XZQDC", string.Format(@"select Cells_X,Cells_Y,BGMJ from ( select BGQDLBM,sum(BGMJ) BGMJ from ( select substr(BGQDLBM, 1, 4) BGQDLBM,substr(BGQCZCSXM, 1, 3) BGQCZCSXM, substr(BGHDLBM, 1, 4) BGHDLBM,substr(BGHCZCSXM, 1,3) BGHCZCSXM,BGMJ from JCTJB_GQ where XZQTZLX in ('2','4') )A where BGQCZCSXM='204' and (BGQDLBM<>BGHDLBM or BGQCZCSXM<>BGHCZCSXM) GROUP BY BGQDLBM )A left join CSNBTDLYBHTJB B on a.BGQDLBM=b.bgh where B.Cells_X=6 "), true); if (dt != null && dt.Rows.Count > 0) { resultdataTable.Merge(dt); } CellHelper.SetFileToDisk(resultdataTable, savePath, 0); #endregion CellHelper.Import(savePath); #region 年末面积平差 Workbook workbook = new Workbook(savePath); Worksheet sheet = workbook.Worksheets[0]; Range dataRange = null; dataRange = sheet.Cells.CreateRange("C11:BS11"); var XJ = new List() { 0, 9, 13, 18, 23, 27, 30, 33, 36, 42, 52, 60 }; for (int i = 0; i < dataRange.ColumnCount; i++) { if (XJ.Contains(i)) continue; var xx = dataRange[0, i].Value.ToDouble(); if (xx < 0) { if (result == null) { result = new BBPCModel(); result.ReportName = 6; result.Columns = new List(); } PCColumnModel coluModel = new PCColumnModel(); coluModel.Ids = new List(); coluModel.IsActive = true; coluModel.ColumnIndex = i; coluModel.DiffValue = Math.Abs(xx); string sql = string.Empty; sql = $@"select * from (select ID, substr(BGQDLBM, 1, 4) BGQDLBM, substr(BGQCZCSXM, 1, 3) BGQCZCSXM, substr(BGHDLBM, 1, 4) BGHDLBM, substr(BGHCZCSXM, 1, 3) BGHCZCSXM, BGMJ from JCTJB_GQ)A WHERE BGQCZCSXM = '204' and(BGQDLBM <> BGHDLBM or BGQCZCSXM <> BGHCZCSXM) AND BGQDLBM = (select bgh from CSNBTDLYBHTJB WHERE Cells_X = '9' AND Cells_Y = '{i + 2}')"; DataTable IDsTable = dbHelper.ExecuteDatatable("ids", sql, true); string ids = string.Empty; foreach (DataRow row in IDsTable.Rows) { coluModel.Ids.Add(Convert.ToInt32(row[0])); } result.Columns.Add(coluModel); } } #endregion return result; } catch (Exception e) { throw e; } finally { } } public List> GetResults_Excel(string sTableName) { List> result = new List>(); try { XmlDocument doc = new XmlDocument(); string strPath = SysAppPath.GetCurrentAppPath(); strPath += @"Configs\Results_Excel.xml"; doc.Load(strPath); XmlNode nodeDataCatalog = doc.SelectSingleNode("TableName"); if (nodeDataCatalog == null) return result; XmlNode cnodeDataCatalog = nodeDataCatalog.SelectSingleNode(sTableName); foreach (XmlNode item in cnodeDataCatalog.ChildNodes) { Dictionary dic = new Dictionary(); foreach (XmlNode citem in item.ChildNodes) { dic.Add(citem.Attributes["DLBM"].Value, citem.Attributes["Cells"].Value); } result.Add(dic); } return result; } catch (Exception ex) { LogAPI.Debug(ex); throw; } } } }