예제 #1
0
        //批次报批研判
        private static void pcbpJudge(IFeatureLayer pChangeFeaLayer, IFeatureLayer pcbpFeaLayer, IWorkspace pOutWorkSpace, bool useSelection,SysCommon.CProgress vProgress)
        {
            ITable pChangeTable = pChangeFeaLayer as ITable;
            ITable pcbpTable = pcbpFeaLayer as ITable;
            double rol = 0.0001;
            IFeatureClass pcbpFeaClass = pcbpFeaLayer.FeatureClass;
            //创建结果地物类名称
            IFeatureClassName pResFeaClassName = new FeatureClassNameClass();
            String fcName = pcbpFeaClass.AliasName.Trim().Substring(pcbpFeaClass.AliasName.Trim().IndexOf(".") + 1)+"_res";
            IDataset pOutDataset = (IDataset)pOutWorkSpace;
            IDatasetName pOutDatasetName = (IDatasetName)pResFeaClassName;
            pOutDatasetName.WorkspaceName = (IWorkspaceName)pOutDataset.FullName;
            pOutDatasetName.Name = fcName;
            IBasicGeoprocessor pGeoProcessor = new BasicGeoprocessorClass();
            //叠置分析
            pGeoProcessor.Intersect(pChangeTable, useSelection, pcbpTable, false, rol, pResFeaClassName);

            //从叠置结果生成报表
            string connstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + pOutDatasetName.WorkspaceName.PathName;
            OleDbConnection oledbconn = new OleDbConnection(connstr);
            oledbconn.Open();
            ModTableFun.DropTable(oledbconn, "tmprel");
            string sqlstr = "select "+g_XZQHDM+","+g_TBBH+","+g_MJ+" as jctbmj,"+g_PC  +",shape_area as " +g_MJ+",shape_area as zb,"+g_GWYPFWH+" as bpwh,"+g_SGTTPFWH+","+g_SGTJPFWH+" into tmprel from " + fcName;
                            //行政区划代码,编号,监测图斑面积,报批名称,计算面积,占比,批准文号(三个批准文号的备选字段)
            OleDbCommand oledbcomm = oledbconn.CreateCommand();
            oledbcomm.CommandText = sqlstr;
            oledbcomm.ExecuteNonQuery();

            oledbcomm.CommandText = "update tmprel set zb="+g_MJ+"/jctbmj*100";
            oledbcomm.ExecuteNonQuery();
            //报批文号为空,则取省林业厅批复文号
            oledbcomm.CommandText = "update tmprel set bpwh=" + g_SGTTPFWH + " where bpwh is null and " + g_SGTTPFWH + "  is not null";
            oledbcomm.ExecuteNonQuery();
            //报批文号为空,则取省市林业局批复文号
            oledbcomm.CommandText = "update tmprel set bpwh=" + g_SGTJPFWH + " where bpwh is null and " + g_SGTJPFWH + " is not null";
            oledbcomm.ExecuteNonQuery();
            //报表模板路径
            string Templatepath = Application.StartupPath + "\\..\\Template\\批次报批研判模板.cel";
            oledbconn.Close();
            //生成报表对话框
            FormFlexcell frm;
            ModFlexcell.m_SpecialRow = -1;
            ModFlexcell.m_SpecialRow_ex = -1;
            ModFlexcell.m_SpecialRow_ex2 = -1;
            frm = ModFlexcell.SendDataToFlexcell(connstr, "监测图斑报批情况表", "tmprel", g_XZQHDM + "," + g_TBBH + ",jctbmj," + g_PC + "," + g_MJ + "," + g_ZB + ",bpwh", "", Templatepath, 4, 2);

            AxFlexCell.AxGrid pGrid = frm.GetGrid();
            string excelPath = m_WorkPath + "\\监测图斑报批情况表.xls";
            pGrid.ExportToExcel(excelPath);
            
            //frm.SaveFile(m_WorkPath + "\\监测图斑报批情况表.cel");
            //弹出报表
            ModStatReport.OpenExcelFile(excelPath);
            
        }
예제 #2
0
        //森林资源/地类图斑研判
        private static void dltbJudge(IFeatureLayer pChangeFeaLayer, IFeatureLayer dltbFeaLayer, IWorkspace pOutWorkSpace, bool useSelection,SysCommon.CProgress vProgress)
        {
            ITable pChangeTable = pChangeFeaLayer as ITable;
            ITable pcbpTable = dltbFeaLayer as ITable;
            IFeatureClass dltbFeaClass = dltbFeaLayer.FeatureClass;
            double rol = 0.0001;
            IFeatureClassName pResFeaClassName = new FeatureClassNameClass();
            //创建结果地物类名称
            String fcName = dltbFeaClass.AliasName.Trim().Substring(dltbFeaClass.AliasName.Trim().IndexOf(".") + 1)+"_res";
            IDataset pOutDataset = (IDataset)pOutWorkSpace;
            IDatasetName pOutDatasetName = (IDatasetName)pResFeaClassName;
            pOutDatasetName.WorkspaceName = (IWorkspaceName)pOutDataset.FullName;
            pOutDatasetName.Name = fcName;
            IBasicGeoprocessor pGeoProcessor = new BasicGeoprocessorClass();
            //叠置分析
            pGeoProcessor.Intersect(pChangeTable, useSelection, pcbpTable, false, rol, pResFeaClassName);

            //从叠置结果生成报表
            string connstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + pOutDatasetName.WorkspaceName.PathName ;
            OleDbConnection oledbconn = new OleDbConnection(connstr);
            oledbconn.Open();
            ModTableFun.DropTable(oledbconn, "tmprel");
            string sqlstr = "select "+g_XZQHDM+","+g_TBBH+","+g_MJ+" as jctbmj,"+g_TBBH+"_1,"+g_DLBM+","+g_TBMJ+","+g_TBDLMJ+",shape_area as jsmj,shape_area as mj,shape_area as zb into tmprel from " + fcName;
                            //行政区划代码,编号,面积,图斑编号,地类编码,图斑面积,图斑地类面积,计算面积,占比
            OleDbCommand oledbcomm = oledbconn.CreateCommand();
            oledbcomm.CommandText = sqlstr;
            oledbcomm.ExecuteNonQuery();
            //叠置结果地类面积计算方法:  面积=叠置结果计算面积*地类图斑地类面积/地类图斑总面积
            oledbcomm.CommandText = "update tmprel set mj=jsmj*"+g_TBDLMJ+"/"+g_TBMJ+"";
            oledbcomm.ExecuteNonQuery();
            //计算占比
            oledbcomm.CommandText = "update tmprel set zb=mj/jctbmj*100";
            oledbcomm.ExecuteNonQuery();
            //报表模板路径
            oledbconn.Close();
            string Templatepath = Application.StartupPath + "\\..\\Template\\森林资源现状研判模板.cel";
            //生成报表对话框
            FormFlexcell frm;
            ModFlexcell.m_SpecialRow = -1;
            ModFlexcell.m_SpecialRow_ex = -1;
            ModFlexcell.m_SpecialRow_ex2 = -1;
            frm = ModFlexcell.SendDataToFlexcell(connstr, "监测图斑地类情况表", "tmprel", g_XZQHDM + "," + g_TBBH + ",jctbmj," + g_TBBH + "_1,"+g_DLBM+"," + g_MJ + "," + g_ZB, "", Templatepath, 4, 2);

            AxFlexCell.AxGrid pGrid = frm.GetGrid();
            string excelPath = m_WorkPath + "\\监测图斑地类情况表.xls";
            pGrid.ExportToExcel(excelPath);
            
            //frm.SaveFile(m_WorkPath + "\\监测图斑地类情况表.cel");
            //弹出报表
            ModStatReport.OpenExcelFile(excelPath);
            
        }
예제 #3
0
        private void DoStatistic(string XmlPath, string XZQcode, string XZQName, string strYear, string strAreaUnit, int FractionNum, string ResultPath, SysCommon.CProgress vProgress)
        {
            string DLTBNodeKey = "";
            string XZDWNodeKey = "";
            string LXDWNodeKey = "";

            //SysCommon.Log.SysLocalLog pLog = new SysCommon.Log.SysLocalLog();
            //pLog.CreateLogFile(Application.StartupPath+"\\..\\Log\\统计.log");
            ModStatReport.WriteStaticLog("查找森林资源现状数据");
            //pLog.WriteLocalLog("查找森林资源现状数据");
            ModStatReport.GetTDLYLayerKey(XmlPath, XZQcode, strYear, out DLTBNodeKey, out XZDWNodeKey, out LXDWNodeKey);
            if (DLTBNodeKey == "")
            {
                vProgress.Close();
                MessageBox.Show("找不到该行政区的森林资源现状数据!");
                return;
            }
            IFeatureClass pDLTBFeaCls = SysCommon.ModSysSetting.GetFeatureClassByNodeKey(Plugin.ModuleCommon.TmpWorkSpace, XmlPath, DLTBNodeKey);
            IFeatureClass pXZDWFeaCls = SysCommon.ModSysSetting.GetFeatureClassByNodeKey(Plugin.ModuleCommon.TmpWorkSpace, XmlPath, XZDWNodeKey);
            IFeatureClass pLXDWFeaCls = SysCommon.ModSysSetting.GetFeatureClassByNodeKey(Plugin.ModuleCommon.TmpWorkSpace, XmlPath, LXDWNodeKey);

            if (pDLTBFeaCls == null)
            {
                vProgress.Close();
                MessageBox.Show("找不到该行政区的森林资源现状数据!");
                return;
            }
            ModStatReport.WriteStaticLog("创建临时成果数据库");
            //pLog.WriteLocalLog("创建临时成果数据库");
            //string workpath = Application.StartupPath + @"\..\OutputResults\统计成果\" + System.DateTime.Now.ToString("yyyyMMddHHmmss");
            string strMDBName    = XZQName + strYear + "年LandUse" + System.DateTime.Now.ToString("yyyyMMddHHmmss") + ".mdb";
            string workSpaceName = ResultPath + "\\" + strMDBName;

            //判断结果目录是否存在,不存在则创建
            if (System.IO.Directory.Exists(ResultPath) == false)
            {
                System.IO.Directory.CreateDirectory(ResultPath);
            }
            //创建一个新的mdb数据库,并打开工作空间
            if (vProgress != null)
            {
                vProgress.SetProgress("创建结果库...");
            }
            IWorkspace pOutWorkSpace = ChangeJudge.CreatePDBWorkSpace(ResultPath, strMDBName);


            string strDLTBname = "";
            string strXZDWname = "";
            string strLXDWname = "";

            if (pDLTBFeaCls != null)
            {
                ModStatReport.WriteStaticLog("拷贝地类图斑数据");
                CopyPasteGDBData.CopyPasteGeodatabaseData((pDLTBFeaCls as IDataset).Workspace, pOutWorkSpace, (pDLTBFeaCls as IDataset).Name, esriDatasetType.esriDTFeatureClass);

                strDLTBname = (pDLTBFeaCls as IDataset).Name;
                strDLTBname = strDLTBname.Substring(strDLTBname.IndexOf(".") + 1);//added by chulili 20110922 去掉oracle中用户名
            }
            else
            {
                strDLTBname = "";
            }
            if (pXZDWFeaCls != null)
            {
                ModStatReport.WriteStaticLog("拷贝线状地物数据");
                CopyPasteGDBData.CopyPasteGeodatabaseData((pXZDWFeaCls as IDataset).Workspace, pOutWorkSpace, (pXZDWFeaCls as IDataset).Name, esriDatasetType.esriDTFeatureClass);
                strXZDWname = (pXZDWFeaCls as IDataset).Name;
                strXZDWname = strXZDWname.Substring(strXZDWname.IndexOf(".") + 1);//added by chulili 20110922 去掉oracle中用户名
            }
            else
            {
                strXZDWname = "";
            }
            if (pLXDWFeaCls != null)
            {
                ModStatReport.WriteStaticLog("拷贝零星地物数据");
                CopyPasteGDBData.CopyPasteGeodatabaseData((pLXDWFeaCls as IDataset).Workspace, pOutWorkSpace, (pLXDWFeaCls as IDataset).Name, esriDatasetType.esriDTFeatureClass);
                strLXDWname = (pLXDWFeaCls as IDataset).Name;
                strLXDWname = strLXDWname.Substring(strLXDWname.IndexOf(".") + 1);//added by chulili 20110922 去掉oracle中用户名
            }
            else
            {
                strLXDWname = "";
            }


            ModStatReport.WriteStaticLog("拷贝行政区字典表");
            CopyPasteGDBData.CopyPasteGeodatabaseData(Plugin.ModuleCommon.TmpWorkSpace, pOutWorkSpace, Plugin.ModuleCommon.TmpWorkSpace.ConnectionProperties.GetProperty("User").ToString() + ".行政区字典表", esriDatasetType.esriDTTable);
            string strExcelName = XZQName + strYear + "年森林资源现状统计表.xls";

            ModStatReport.WriteStaticLog("拷贝森林资源现状统计模板");
            if (File.Exists(ResultPath + "\\" + strExcelName))
            {
                File.Delete(ResultPath + "\\" + strExcelName);
            }
            File.Copy(Application.StartupPath + "\\..\\Template\\森林资源现状统计模板.xls", ResultPath + "\\" + strExcelName);

            ModStatReport.WriteStaticLog("生成基础统计表");

            ModStatReport.DoLandUseStatic(workSpaceName, strDLTBname, strXZDWname, strLXDWname, vProgress);

            ModStatReport.WriteStaticLog("生成森林资源现状一级分类面积统计表");
            ModStatReport.LandUseCurReport(ResultPath, strMDBName, XZQcode, strAreaUnit, FractionNum, 1, ResultPath + "\\一级分类面积.xls", vProgress);

            ModStatReport.WriteStaticLog("生成森林资源现状二级分类面积统计表");
            ModStatReport.LandUseCurReport(ResultPath, strMDBName, XZQcode, strAreaUnit, FractionNum, 2, ResultPath + "\\二级分类面积.xls", vProgress);


            ModStatReport.WriteStaticLog("拷贝EXCEL中的工作区表");
            ModStatReport.CopyExcelSheet(ResultPath + "\\一级分类面积.xls", "Sheet1", ResultPath + "\\" + strExcelName, "森林资源现状一级分类面积");
            ModStatReport.CopyExcelSheet(ResultPath + "\\二级分类面积.xls", "Sheet1", ResultPath + "\\" + strExcelName, "森林资源现状二级分类面积");
            File.Delete(ResultPath + "\\一级分类面积.xls");
            File.Delete(ResultPath + "\\二级分类面积.xls");
            ModStatReport.WriteStaticLog("打开森林资源现状统计表");
            ModStatReport.OpenExcelFile(ResultPath + "\\" + strExcelName);
            vProgress.Close();
            ModStatReport.WriteStaticLog("统计结束");
            System.Runtime.InteropServices.Marshal.ReleaseComObject(pOutWorkSpace);
            pOutWorkSpace = null;
            try
            {
                File.Delete(workSpaceName);
            }
            catch (Exception err)
            { }
            //pLog = null;
        }
예제 #4
0
        //森林用途研判
        private static void tdytJudge(IFeatureLayer pChangeFeaLayer, IFeatureLayer tdytFeaLayer, IWorkspace pOutWorkSpace, bool useSelection,SysCommon.CProgress vProgress)
        {
            ITable pChangeTable = pChangeFeaLayer as ITable;
            ITable tdytTable = tdytFeaLayer as ITable;
            double rol = 0.0001;
            IFeatureClass tdytFeaClass = tdytFeaLayer.FeatureClass;
            //创建结果地物类名称
            IFeatureClassName pResFeaClassName = new FeatureClassNameClass();
            String fcName = tdytFeaClass.AliasName.Trim().Substring(tdytFeaClass.AliasName.Trim().IndexOf(".") + 1)+"_res";
            IDataset pOutDataset = (IDataset)pOutWorkSpace;
            IDatasetName pOutDatasetName = (IDatasetName)pResFeaClassName;
            pOutDatasetName.WorkspaceName = (IWorkspaceName)pOutDataset.FullName;
            pOutDatasetName.Name = fcName;
            IBasicGeoprocessor pGeoProcessor = new BasicGeoprocessorClass();
            //叠置分析
            pGeoProcessor.Intersect(pChangeTable, useSelection, tdytTable, false, rol, pResFeaClassName);

            //从叠置结果生成报表
            string connstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + pOutDatasetName.WorkspaceName.PathName;
            OleDbConnection oledbconn = new OleDbConnection(connstr);
            oledbconn.Open();
            ModTableFun.DropTable(oledbconn,"tmprel");
            string sqlstr = "select "+g_XZQHDM+","+g_TBBH+","+g_MJ+" as jctbmj,"+g_TDYTFQBH+","+g_TDYTFQDM+",shape_area as jsmj,shape_area as mj,shape_area as zb into tmprel from " + fcName;
                            //行政区划代码,编号,监测图斑面积,规划图斑编号,规划用地用途代码
            OleDbCommand oledbcomm = oledbconn.CreateCommand();
            oledbcomm.CommandText = sqlstr;
            oledbcomm.ExecuteNonQuery();

            oledbcomm.CommandText = "update tmprel set zb=mj/jctbmj*100";
            oledbcomm.ExecuteNonQuery();

            ModTableFun.DropTable(oledbconn ,"森林用途字典");
            CopyTdytDictionary(oledbconn);//从业务库里面拷贝森林用途字典过来
            
            //根据森林用途字典更新森林用途名称
            oledbcomm.CommandText = "alter table tmprel add tdytmc text(30)";
            oledbcomm.ExecuteNonQuery();
            oledbcomm.CommandText = "update tmprel set tdytmc=" + g_TDYTFQDM;
            oledbcomm.ExecuteNonQuery();
            if (ModTableFun.isExist(oledbconn,"森林用途字典"))
            {               
                oledbcomm.CommandText = "update tmprel a,森林用途字典 b set a.tdytmc=b.森林用途分区类型 where a." + g_TDYTFQDM + "=b.代码";
                oledbcomm.ExecuteNonQuery();
            }
            //报表模板路径
            string Templatepath = Application.StartupPath + "\\..\\Template\\森林资源规划研判模板.cel";
            //生成报表对话框
            oledbconn.Close();
            FormFlexcell frm;
            ModFlexcell.m_SpecialRow = -1;
            ModFlexcell.m_SpecialRow_ex = -1;
            ModFlexcell.m_SpecialRow_ex2 = -1;
            //规划图斑没有图斑编号怎么办??暂时使用森林用途分区编号
            frm = ModFlexcell.SendDataToFlexcell(connstr, "监测图斑规划情况表", "tmprel", g_XZQHDM + "," + g_TBBH + ",jctbmj,TDYTFQBH,tdytmc," + g_MJ + "," + g_ZB, "", Templatepath, 4, 2);
            //弹出报表对话框

            AxFlexCell.AxGrid pGrid = frm.GetGrid();
            string excelPath = m_WorkPath + "\\监测图斑规划情况表.xls";
            pGrid.ExportToExcel(excelPath);

            //frm.SaveFile(m_WorkPath + "\\监测图斑规划情况表.cel");
            ModStatReport.OpenExcelFile(excelPath);
            
        }
예제 #5
0
        //added by chulili 20110914 指定范围森林资源现状统计,指定范围来自一个地物类
        //changed by chulili 20110919 删除行政区编码参数,改为从数据中直接获取
        private void DoImportAreaLandUseStatic(string XmlPath, IFeatureClass pImportFeaClass, string strYear, string strAreaUnit, int FractionNum, bool SelectTDLY, bool SelectZTGH, string ResultPath, SysCommon.CProgress pProgress)
        {
            string StaticConfigPath = Application.StartupPath + "\\..\\Res\\Xml\\StatisticConfig.xml";

            SysCommon.ModSysSetting.CopyConfigXml(Plugin.ModuleCommon.TmpWorkSpace, "查询配置", StaticConfigPath);
            //读取xml文件
            XmlDocument pXmlDoc = new XmlDocument();

            pXmlDoc.Load(StaticConfigPath);
            //读取
            ModStatReport.WriteStaticLog("读取统计配置");
            if (pProgress != null)
            {
                pProgress.SetProgress("读取统计配置...");
            }
            string strSearch     = "//StatisticConfig";
            string LayerTreePath = Application.StartupPath + "\\..\\Res\\Xml\\展示图层树0.xml";

            SysCommon.ModSysSetting.CopyLayerTreeXmlFromDataBase(Plugin.ModuleCommon.TmpWorkSpace, LayerTreePath);
            XmlNode pXmlNode = pXmlDoc.SelectSingleNode(strSearch);

            if (pXmlNode == null)
            {
                if (pProgress != null)
                {
                    pProgress.Close();
                }
                System.IO.File.Delete(StaticConfigPath);
                System.IO.File.Delete(LayerTreePath);
                return;
            }
            //直接从数据源中获取地物类
            if (pProgress != null)
            {
                pProgress.SetProgress("获取统计图层...");
            }
            ModStatReport.WriteStaticLog("读取统计配置中的行政区");
            IFeatureClass pXZQFeatureClass = null;
            XmlNode       pXZQNode         = null;

            try
            {
                pXZQNode = pXmlNode["XZQ"];
            }
            catch (Exception err)
            { }
            //获取行政区划层
            if (pXZQNode != null)
            {
                string strNodeKey = "";
                if ((pXZQNode as XmlElement).HasAttribute("TableNodeKey"))
                {
                    strNodeKey = pXZQNode.Attributes["TableNodeKey"].Value;
                }
                ModStatReport.WriteStaticLog("读取行政区层");
                pXZQFeatureClass = SysCommon.ModSysSetting.GetFeatureClassByNodeKey(Plugin.ModuleCommon.TmpWorkSpace, LayerTreePath, strNodeKey);
            }
            if (pXZQFeatureClass == null)
            {
                if (pProgress != null)
                {
                    pProgress.Close();
                }
                MessageBox.Show("未找到行政区划图层!请检查配置文件");
                ModStatReport.WriteStaticLog("未找到行政区划图层,退出");
                System.IO.File.Delete(StaticConfigPath);
                System.IO.File.Delete(LayerTreePath);
                return;
            }
            //string workpath = Application.StartupPath + @"\..\OutputResults\统计成果\" + System.DateTime.Now.ToString("yyyyMMddHHmmss");
            ModStatReport.WriteStaticLog("创建临时成果数据库");
            string strMDBName    = "ImportStatistic" + System.DateTime.Now.ToString("yyyyMMddHHmmss") + ".mdb";
            string workSpaceName = ResultPath + "\\" + strMDBName;

            //判断结果目录是否存在,不存在则创建
            if (System.IO.Directory.Exists(ResultPath) == false)
            {
                System.IO.Directory.CreateDirectory(ResultPath);
            }
            //创建一个新的mdb数据库,并打开工作空间
            if (pProgress != null)
            {
                pProgress.SetProgress("创建结果库...");
            }
            IWorkspace        pOutWorkSpace    = ChangeJudge.CreatePDBWorkSpace(ResultPath, strMDBName);
            IFeatureWorkspace pOutFeaWorkSpace = pOutWorkSpace as IFeatureWorkspace;

            //叠置分析
            if (pProgress != null)
            {
                pProgress.SetProgress("进行叠置分析...");
            }
            //行政区划叠置
            string            strXZQResName   = "XZQ_RES";
            IFeatureClassName pResDataName    = new FeatureClassNameClass();
            IDataset          pOutDataset     = (IDataset)pOutWorkSpace;
            IDatasetName      pOutDatasetName = (IDatasetName)pResDataName;

            pOutDatasetName.WorkspaceName = (IWorkspaceName)pOutDataset.FullName;
            pOutDatasetName.Name          = strXZQResName;
            IBasicGeoprocessor pGeoProcessor = new BasicGeoprocessorClass();
            double             rol           = 0.001;

            ModStatReport.WriteStaticLog("叠置行政区图层");
            pGeoProcessor.Intersect(pXZQFeatureClass as ITable, false, pImportFeaClass as ITable, false, rol, pResDataName);
            string strXZQCode = ModStatReport.GetXZQcode(workSpaceName, strXZQResName);

            if (strXZQCode.Equals(""))
            {
                if (pProgress != null)
                {
                    pProgress.Close();
                }
                MessageBox.Show("找不到导入区域所在的行政区!请验证导入区域与行政区划图层的位置关系。");
                ModStatReport.WriteStaticLog("找不到导入区域所在的行政区,退出");
                pResDataName  = null;
                pGeoProcessor = null;
                pXmlDoc       = null;
                System.IO.File.Delete(StaticConfigPath);
                System.IO.File.Delete(LayerTreePath);
                return;
            }
            string DLTBNodeKey = "";
            string XZDWNodeKey = "";
            string LXDWNodeKey = "";
            string JBNTNodeKey = "";
            string YTFQNodeKey = "";
            string JSYDNodeKey = "";

            IFeatureClass pDLTBFeaCls = null;
            IFeatureClass pXZDWFeaCls = null;
            IFeatureClass pLXDWFeaCls = null;

            string strDLTBResName = "DLTB_RES";
            string strXZDWResName = "XZDW_RES";
            string strLXDWResName = "LXDW_RES";

            IFeatureClass pJBNTFeaCls = null;
            IFeatureClass pYTFQFeaCls = null;
            IFeatureClass pJSYDFeaCls = null;

            string strJBNTResName = "JBNT_RES";
            string strYTFQResName = "YTFQ_RES";
            string strJSYDResName = "JSYD_RES";

            if (SelectTDLY)
            {
                ModStatReport.WriteStaticLog("获取叠置行政区内的森林资源图层标识号");
                ModStatReport.GetTDLYLayerKey(XmlPath, strXZQCode, strYear, out DLTBNodeKey, out XZDWNodeKey, out LXDWNodeKey);
                ModStatReport.WriteStaticLog("获取叠置行政区内的森林资源图层");
                pDLTBFeaCls = SysCommon.ModSysSetting.GetFeatureClassByNodeKey(Plugin.ModuleCommon.TmpWorkSpace, XmlPath, DLTBNodeKey);
                pXZDWFeaCls = SysCommon.ModSysSetting.GetFeatureClassByNodeKey(Plugin.ModuleCommon.TmpWorkSpace, XmlPath, XZDWNodeKey);
                pLXDWFeaCls = SysCommon.ModSysSetting.GetFeatureClassByNodeKey(Plugin.ModuleCommon.TmpWorkSpace, XmlPath, LXDWNodeKey);

                pProgress.SetProgress("正在叠置分析地类图斑数据...");
                pOutDatasetName.Name = strDLTBResName;
                ModStatReport.WriteStaticLog("叠置分析地类图斑图层");
                pGeoProcessor.Intersect(pDLTBFeaCls as ITable, false, pImportFeaClass as ITable, false, rol, pResDataName);
                IFeatureClass pTBFeaCls = pOutFeaWorkSpace.OpenFeatureClass(strDLTBResName);
                SysCommon.modCalArea.CalCulateAllipsoidArea(pTBFeaCls, "TBMJ", 114);
                //线状地物叠置
                if (pXZDWFeaCls != null)
                {
                    pProgress.SetProgress("正在叠置分析线状地物数据...");
                    pOutDatasetName.Name = strXZDWResName;
                    //叠置分析
                    ModStatReport.WriteStaticLog("叠置分析线状地物图层");
                    pGeoProcessor.Intersect(pXZDWFeaCls as ITable, false, pImportFeaClass as ITable, false, rol, pResDataName);
                }
                else
                {
                    strXZDWResName = "";
                }

                //零星地物叠置
                if (pLXDWFeaCls != null)
                {
                    pProgress.SetProgress("正在叠置分析零星地物数据...");
                    pOutDatasetName.Name = strLXDWResName;
                    //叠置分析
                    ModStatReport.WriteStaticLog("叠置分析零星地物图层");
                    pGeoProcessor.Intersect(pLXDWFeaCls as ITable, false, pImportFeaClass as ITable, false, rol, pResDataName);
                }
                else
                {
                    strLXDWResName = "";
                }
                try
                {
                    pProgress.SetProgress("正在组织森林资源现状数据...");
                    ModStatReport.WriteStaticLog("拷贝行政区字典");
                    CopyPasteGDBData.CopyPasteGeodatabaseData(Plugin.ModuleCommon.TmpWorkSpace, pOutWorkSpace, Plugin.ModuleCommon.TmpWorkSpace.ConnectionProperties.GetProperty("User").ToString() + ".行政区字典表", esriDatasetType.esriDTTable);
                    //CopyPasteGDBData.CopyPasteGeodatabaseData(Plugin.ModuleCommon.TmpWorkSpace, pOutWorkSpace, Plugin.ModuleCommon.TmpWorkSpace.ConnectionProperties.GetProperty("User").ToString() + ".森林用途字典", esriDatasetType.esriDTTable);
                }
                catch
                { }
            }
            if (SelectZTGH)
            {
                ModStatReport.WriteStaticLog("获取叠置行政区内的总体规划图层标识号");
                ModStatReport.GetZTGHLayerKey(XmlPath, strXZQCode, out JBNTNodeKey, out YTFQNodeKey, out JSYDNodeKey);
                pJBNTFeaCls = SysCommon.ModSysSetting.GetFeatureClassByNodeKey(Plugin.ModuleCommon.TmpWorkSpace, XmlPath, JBNTNodeKey);
                pYTFQFeaCls = SysCommon.ModSysSetting.GetFeatureClassByNodeKey(Plugin.ModuleCommon.TmpWorkSpace, XmlPath, YTFQNodeKey);
                pJSYDFeaCls = SysCommon.ModSysSetting.GetFeatureClassByNodeKey(Plugin.ModuleCommon.TmpWorkSpace, XmlPath, JSYDNodeKey);

                //基本农田叠置
                if (pJBNTFeaCls != null)
                {
                    pProgress.SetProgress("正在叠置分析基本农田数据...");
                    pOutDatasetName.Name = strJBNTResName;
                    //叠置分析
                    ModStatReport.WriteStaticLog("叠置分析基本农田图层");
                    pGeoProcessor.Intersect(pJBNTFeaCls as ITable, false, pImportFeaClass as ITable, false, rol, pResDataName);
                    IFeatureClass pResJBNTFeaCls = pOutFeaWorkSpace.OpenFeatureClass(strJBNTResName);
                    SysCommon.modCalArea.CalCulateAllipsoidArea(pResJBNTFeaCls, "JBNTMJ", 114);
                }
                else
                {
                    strJBNTResName = "";
                }
                //用途分区叠置
                if (pYTFQFeaCls != null)
                {
                    pProgress.SetProgress("正在叠置分析森林用途分区数据...");
                    pOutDatasetName.Name = strYTFQResName;
                    //叠置分析
                    ModStatReport.WriteStaticLog("叠置分析森林用途图层");
                    pGeoProcessor.Intersect(pYTFQFeaCls as ITable, false, pImportFeaClass as ITable, false, rol, pResDataName);
                    IFeatureClass pResTDYTFeaCls = pOutFeaWorkSpace.OpenFeatureClass(strYTFQResName);
                    SysCommon.modCalArea.CalCulateAllipsoidArea(pResTDYTFeaCls, "MJ", 114);
                }
                else
                {
                    strYTFQResName = "";
                }
                //建设用地叠置
                if (pJSYDFeaCls != null)
                {
                    pProgress.SetProgress("正在叠置分析建设用地管制分区数据...");
                    pOutDatasetName.Name = strJSYDResName;
                    //叠置分析
                    ModStatReport.WriteStaticLog("叠置分析建设用地图层");
                    pGeoProcessor.Intersect(pJSYDFeaCls as ITable, false, pImportFeaClass as ITable, false, rol, pResDataName);
                    IFeatureClass pResJSYDFeaCls = pOutFeaWorkSpace.OpenFeatureClass(strJSYDResName);
                    SysCommon.modCalArea.CalCulateAllipsoidArea(pResJSYDFeaCls, "MJ", 114);
                }
                else
                {
                    strJSYDResName = "";
                }
            }
            pOutWorkSpace = null;
            pResDataName  = null;
            pGeoProcessor = null;
            //try
            //{
            //    File.Delete(workSpaceName);
            //}
            //catch(Exception err)
            //{}
            if (!SelectTDLY)
            {
                ModStatReport.WriteStaticLog("拷贝规划模板");
                if (File.Exists(ResultPath + "\\规划统计表.xls"))
                {
                    File.Delete(ResultPath + "\\规划统计表.xls");
                }
                File.Copy(Application.StartupPath + "\\..\\Template\\规划统计模板ZTGH.xls", ResultPath + "\\规划统计表.xls");
            }
            else if (!SelectZTGH)
            {
                ModStatReport.WriteStaticLog("拷贝森林资源模板");
                if (File.Exists(ResultPath + "\\规划统计表.xls"))
                {
                    File.Delete(ResultPath + "\\规划统计表.xls");
                }
                File.Copy(Application.StartupPath + "\\..\\Template\\规划统计模板TDLY.xls", ResultPath + "\\规划统计表.xls");
            }
            else
            {
                ModStatReport.WriteStaticLog("拷贝森林资源的总体模板");
                File.Copy(Application.StartupPath + "\\..\\Template\\规划统计模板.xls", ResultPath + "\\规划统计表.xls");
            }
            if (SelectTDLY)
            {
                if (pProgress != null)
                {
                    pProgress.SetProgress("生成森林资源现状数据基础统计表...");
                }
                string resDLTB = "";
                ModStatReport.WriteStaticLog("重新计算图斑的各种面积");
                ModStatReport.ComputeXZDWMJ(workSpaceName, strDLTBResName, strXZDWResName, out resDLTB);
                if (resDLTB != "")
                {
                    strDLTBResName = resDLTB;
                }
                //string connstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + workSpaceName;
                //OleDbConnection oledbconn = new OleDbConnection(connstr);
                //oledbconn.Open();
                //OleDbCommand oledbcomm = oledbconn.CreateCommand();

                //oledbcomm.CommandText = "update " + strDLTBResName + " set " + ModFieldConst.g_TBJMJ + " =round(" + ModFieldConst.g_TBJMJ + "*shape_area/" + ModFieldConst.g_TBMJ + ",2)," + ModFieldConst.g_TKMJ + "=round(" + ModFieldConst.g_TKMJ + "*shape_area/" + ModFieldConst.g_TBMJ + ",2) where " + ModFieldConst.g_TBMJ + ">0 and (" + ModFieldConst.g_TBMJ + "-shape_area)>0.01";
                //oledbcomm.ExecuteNonQuery();
                //if (strXZDWResName != "")
                //{
                //    oledbcomm.CommandText = "update " + strXZDWResName + " set " + ModFieldConst.g_XZMJ + " =round(" + ModFieldConst.g_XZMJ + "*shape_length/" + ModFieldConst.g_ChangDu + ",2) where " + ModFieldConst.g_ChangDu + ">0 and (" + ModFieldConst.g_ChangDu + "-shape_length)>0.01";
                //    oledbcomm.ExecuteNonQuery();
                //}
                //oledbconn.Close();
                ModStatReport.WriteStaticLog("生成基础统计表");
                ModStatReport.DoLandUseStatic(workSpaceName, strDLTBResName, strXZDWResName, strLXDWResName, null);
                if (pProgress != null)
                {
                    pProgress.SetProgress("生成森林资源现状一级分类面积汇总表...");
                }
                ModStatReport.WriteStaticLog("生成森林资源现状一级分类面积汇总表");
                ModStatReport.LandUseCurReport(ResultPath, strMDBName, strXZQCode, strAreaUnit, FractionNum, 1, ResultPath + "\\一级分类面积.xls", null);
                if (pProgress != null)
                {
                    pProgress.SetProgress("生成森林资源现状二级分类面积汇总表...");
                }
                ModStatReport.WriteStaticLog("生成森林资源现状二级分类面积汇总表");
                ModStatReport.LandUseCurReport(ResultPath, strMDBName, strXZQCode, strAreaUnit, FractionNum, 2, ResultPath + "\\二级分类面积.xls", null);
            }
            if (SelectZTGH)
            {
                ModStatReport.WriteStaticLog("基本农田占用分析");
                ModStatReport.DoJBNTStatistic(ResultPath, strMDBName, strJBNTResName, Application.StartupPath + "\\..\\Template\\基本农田压占统计表.cel", ResultPath + "\\基本农田.xls", strAreaUnit, FractionNum);
                ModStatReport.WriteStaticLog("森林用途占用分析");
                ModStatReport.DoYTFQStatistic(ResultPath, strMDBName, strYTFQResName, Application.StartupPath + "\\..\\Template\\森林用途区压占统计表.cel", ResultPath + "\\森林用途.xls", strAreaUnit, FractionNum);
                ModStatReport.WriteStaticLog("建设用地占用分析");
                ModStatReport.DoJSYDStatistic(ResultPath, strMDBName, strJSYDResName, Application.StartupPath + "\\..\\Template\\建设用地管制区压占统计表.cel", ResultPath + "\\建设用地.xls", strAreaUnit, FractionNum);
            }
            if (SelectTDLY)
            {
                pProgress.SetProgress("生成森林资源现状数据分析结果...");
                ModStatReport.WriteStaticLog("拷贝EXCEL中工作区表");
                ModStatReport.CopyExcelSheet(ResultPath + "\\一级分类面积.xls", "Sheet1", ResultPath + "\\规划统计表.xls", "森林资源现状一级分类面积");
                ModStatReport.CopyExcelSheet(ResultPath + "\\二级分类面积.xls", "Sheet1", ResultPath + "\\规划统计表.xls", "森林资源现状二级分类面积");
                File.Delete(ResultPath + "\\一级分类面积.xls");
                File.Delete(ResultPath + "\\二级分类面积.xls");
            }
            if (SelectZTGH)
            {
                pProgress.SetProgress("生成森林资源总体规划数据分析结果...");
                ModStatReport.WriteStaticLog("拷贝EXCEL中工作区表");
                ModStatReport.CopyExcelSheet(ResultPath + "\\基本农田.xls", "Sheet1", ResultPath + "\\规划统计表.xls", "基本农田");
                ModStatReport.CopyExcelSheet(ResultPath + "\\森林用途.xls", "Sheet1", ResultPath + "\\规划统计表.xls", "森林用途分区");
                ModStatReport.CopyExcelSheet(ResultPath + "\\建设用地.xls", "Sheet1", ResultPath + "\\规划统计表.xls", "建设用地管制区");

                File.Delete(ResultPath + "\\基本农田.xls");
                File.Delete(ResultPath + "\\森林用途.xls");
                File.Delete(ResultPath + "\\建设用地.xls");
            }
            try
            {
                File.Delete(workSpaceName);
            }
            catch (Exception err)
            {}
            ModStatReport.WriteStaticLog("打开统计结果");
            ModStatReport.OpenExcelFile(ResultPath + "\\规划统计表.xls");
            if (pProgress != null)
            {
                pProgress.Close();
            }
            pResDataName  = null;
            pGeoProcessor = null;
            pXmlDoc       = null;
            ModStatReport.WriteStaticLog("统计结束");
            System.Runtime.InteropServices.Marshal.ReleaseComObject(pOutWorkSpace);
            pOutWorkSpace = null;
            try
            {
                File.Delete(workSpaceName);
            }
            catch (Exception err)
            { }

            System.IO.File.Delete(StaticConfigPath);
            System.IO.File.Delete(LayerTreePath);
        }