年度变更建库软件5.0版本
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

569 lines
32 KiB

using KGIS.Framework.DBOperator;
using KGIS.Framework.Maps;
using KGIS.Framework.Platform;
using KGIS.Framework.Platform.Helper;
using KGIS.Framework.Utils;
using KGIS.Framework.Utils.Helper;
using kingo.Plugin.BGResultManager.Interface;
using Kingo.Plugin.BGResultManager.Model;
using Kingo.PluginServiceInterface;
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
namespace Kingo.Plugin.BGResultManager.Utility
{
public class ExportHelper : IStatisticExport
{
public List<ReportEntityClass> GetReportEntityClassList()
{
List<ReportEntityClass> result = new List<ReportEntityClass>();
result = new List<ReportEntityClass>();
result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum.TDLYXZYJFLMJHZB, Name = "土地利用现状一级分类面积汇总表", TempalateFileName = "土地利用现状一级分类面积汇总表" });
//result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum.LDTDLYXZYJFLMJHZB, Name = "土地利用现状一级分类面积汇总表", TempalateFileName = "土地利用现状一级分类面积汇总表" });
result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum.HDTDLYXZYJFLMJHZB, Name = "海岛土地利用现状一级分类面积汇总表", TempalateFileName = "海岛土地利用现状一级分类面积汇总表" });
result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum.FRDTDLYXZYJFLMJHZB, Name = "飞入地土地利用现状一级分类面积汇总表", TempalateFileName = "飞入地土地利用现状一级分类面积汇总表" });
result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum.TDLYXZEJFLMJHZB, Name = "土地利用现状分类面积汇总表", TempalateFileName = "土地利用现状分类面积汇总表" });
//result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum.LDTDLYXZEJFLMJHZB, Name = "土地利用现状分类面积汇总表", TempalateFileName = "土地利用现状分类面积汇总表" });
result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum.HDTDLYXZEJFLMJHZB, Name = "海岛土地利用现状分类面积汇总表", TempalateFileName = "海岛土地利用现状分类面积汇总表" });
result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum.FRDTDLYXZEJFLMJHZB, Name = "飞入地土地利用现状分类面积汇总表", TempalateFileName = "飞入地土地利用现状分类面积汇总表" });
result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum.TDLYXZYJFLMJAQSXZHZB, Name = "土地利用现状一级分类面积按权属性质汇总表", TempalateFileName = "土地利用现状一级分类面积按权属性质汇总表" });
result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum.FRDTDLYXZYJFLMJAQSXZHZB, Name = "飞入地土地利用现状一级分类面积按权属性质汇总表", TempalateFileName = "飞入地土地利用现状一级分类面积按权属性质汇总表" });
result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum.CZCJGKYDMJHZB, Name = "城镇村及工矿用地面积汇总表", TempalateFileName = "城镇村及工矿用地面积汇总表" });
result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum.FRDCZCJGKYDMJHZB, Name = "飞入地城镇村及工矿用地面积汇总表", TempalateFileName = "飞入地城镇村及工矿用地面积汇总表" });
result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum.GDPDFJMJHZB, Name = "耕地坡度分级面积汇总表", TempalateFileName = "耕地坡度分级面积汇总表" });
result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum.GDZZLXMJTJB, Name = "耕地种植类型面积统计表", TempalateFileName = "耕地种植类型面积统计表" });
result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum.LXFWNYDHZTJB, Name = "林区范围内种植园用地汇总统计表", TempalateFileName = "林区范围内种植园用地汇总统计表" });
result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum.GCCDXSCDHZQKTJB, Name = "灌丛草地汇总情况统计表", TempalateFileName = "灌丛草地汇总情况统计表" });
result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum.GYYDALXHZTJB, Name = "工业用地按类型汇总统计表", TempalateFileName = "工业用地按类型汇总统计表" });
result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum.KTZDLMJHZB, Name = "可调整地类面积汇总表", TempalateFileName = "可调整地类面积汇总表" });
result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum.BFXHDLMJHZB, Name = "部分细化地类面积汇总表", TempalateFileName = "部分细化地类面积汇总表" });
//result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum.SDDCMJTJB, Name = "湿地调查面积统计表", TempalateFileName = "湿地调查面积统计表" });
result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum.GDXHDCQKTJB, Name = "耕地细化调查情况统计表", TempalateFileName = "耕地细化调查情况统计表" });
result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum.PZWJSDJSYDYTQKTJB, Name = "批准未建设的建设用地用途情况统计表", TempalateFileName = "批准未建设的建设用地用途情况统计表" });
result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum.PZWJSDJSYDXZQKTJB, Name = "批准未建设的建设用地现状情况统计表", TempalateFileName = "批准未建设的建设用地现状情况统计表" });
result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum.DSCGTDCYGQKTJB, Name = "第三次全国国土调查有关情况统计表(生空模板)", TempalateFileName = "第三次全国国土调查有关情况统计表" });
result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum.QSDWDMB, Name = "权属单位代码表", TempalateFileName = "权属单位代码表" });
//result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum.TDDCJLB, Name = "土地调查记录表(生空模板)", TempalateFileName = "土地调查记录表" });
//result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum.YFTKXSCSB, Name = "样方田坎系数测算表(生空模板)", TempalateFileName = "样方田坎系数测算表" });
//result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum.KCXS, Name = "田坎系数(生空模板)", TempalateFileName = "田坎系数" });
//白明雅 2018-12-03
// 王靖 2019-01-24
//result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum.YFTKXSCS, Name = "样方田坎系数测算表", TempalateFileName = "样方田坎系数测算表" });
//result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum.TKXS, Name = "田坎系数", TempalateFileName = "田坎系数" });
//-----------------------------------
//霍岩 2019-02-22 添加永久基本农田现状情况统计表
result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum.YJJBNTXZQKTJB, Name = "永久基本农田现状情况统计表", TempalateFileName = "永久基本农田现状情况统计表" });
//霍岩 2019-04-02 添加无居民海岛统计表
result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum.WJMHDTJB, Name = "无居民海岛现状调查分类面积汇总表", TempalateFileName = "无居民海岛现状调查分类面积汇总表" });
//霍岩 2019-04-03 添加即可恢复与工程恢复种植属性汇总统计表
result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum.JKHFGCHFZZTJB, Name = "即可恢复与工程恢复种植属性汇总统计表", TempalateFileName = "即可恢复与工程恢复种植属性汇总统计表" });
//霍岩 2019-04-03 添加废弃细化标注汇总统计表
result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum.FQXHBZTJB, Name = "废弃与垃圾填埋细化标注汇总统计表", TempalateFileName = "废弃与垃圾填埋细化标注汇总统计表" });
return result;
}
/// <summary>
/// 文字输出报表列
/// </summary>
/// <returns></returns>
/// 白明雅 2018-12-03
public List<ReportEntityClass> GetReportlanguageOutEntityClassList()
{
List<ReportEntityClass> result = new List<ReportEntityClass>();
result = new List<ReportEntityClass>();
result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum.GTDCGZBG, Name = "第三次国土调查工作报告", TempalateFileName = "第三次国土调查工作报告" });
result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum.GTDCJSBG, Name = "第三次国土调查技术报告", TempalateFileName = "第三次国土调查技术报告" });
result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum.GTDCSJKJSBG, Name = "第三次国土调查数据库建设报告", TempalateFileName = "第三次国土调查数据库建设报告" });
result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum.GTDCCGFXBG, Name = "第三次国土调查成果分析报告", TempalateFileName = "第三次国土调查成果分析报告" });
result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum.CZCZTDLYXZFXBG, Name = "城镇村庄土地利用状况分析报告", TempalateFileName = "城镇村庄土地利用状况分析报告" });
result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum.TDDCSJKZLJCBG, Name = "第三次国土调查数据库质量检查报告", TempalateFileName = "第三次国土调查数据库质量检查报告" });
result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum.ZXDCCGBG, Name = "专项调查成果报告", TempalateFileName = "专项调查成果报告" });
result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum.HDDCCGBG, Name = "海岛调查成果报告", TempalateFileName = "海岛调查成果报告" });
return result;
}
/// <summary>
/// 增量管理导出列表 王欢 2018-12-03
/// </summary>
/// <returns></returns>
public List<ReportEntityClass> GetReportEntityZLGLClassList()
{
List<ReportEntityClass> result = new List<ReportEntityClass>();
result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum., Name = "土地变更一览表", TempalateFileName = "土地变更一览表" });
result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum., Name = "土地利用现状变更表", TempalateFileName = "土地利用现状变更表" });
result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum., Name = "土地利用现状一级分类面积按权属性质变化统计表", TempalateFileName = "土地利用现状一级分类面积按权属性质变化统计表" });
result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum., Name = "土地利用现状二级分类面积按权属性质变化统计表", TempalateFileName = "土地利用现状二级分类面积按权属性质变化统计表" });
result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum., Name = "城镇村及工矿用地面积变化统计表", TempalateFileName = "城镇村及工矿用地面积变化统计表" });
result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum., Name = "城市内部土地利用变化统计表", TempalateFileName = "城市内部土地利用变化统计表" });
result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum., Name = "建制镇内部土地利用现状表", TempalateFileName = "建制镇内部土地利用现状表" });
result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum., Name = "村庄内部土地利用变化统计表", TempalateFileName = "村庄内部土地利用变化统计表" });
result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum., Name = "工矿用地内部土地利用变化统计表", TempalateFileName = "工矿用地内部土地利用变化统计表" });
result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum., Name = "特殊用地内部土地利用变化统计表", TempalateFileName = "特殊用地内部土地利用变化统计表" });
result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum., Name = "耕地坡度分级面积变化统计表", TempalateFileName = "耕地坡度分级面积变化统计表" });
result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum., Name = "耕地种植类型面积变化统计表", TempalateFileName = "耕地种植类型面积变化统计表" });
result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum., Name = "林区范围内园地变化统计表", TempalateFileName = "林区范围内园地变化统计表" });
result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum., Name = "灌丛草地汇总情况变化统计表", TempalateFileName = "灌丛草地汇总情况变化统计表" });
result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum., Name = "工业用地按类型汇总变化统计表", TempalateFileName = "工业用地按类型汇总变化统计表" });
result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum., Name = "可调整地类面积变化统计表", TempalateFileName = "可调整地类面积变化统计表" });
result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum., Name = "部分细化地类面积变化统计表", TempalateFileName = "部分细化地类面积变化统计表" });
result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum., Name = "废弃与垃圾填埋细化标注变化统计表", TempalateFileName = "废弃与垃圾填埋细化标注变化统计表" });
result.Add(new ReportEntityClass() { ReportType = ReportTypeEnum., Name = "三大类土地利用现状变更表", TempalateFileName = "三大类土地利用现状变更表" });
return result;
}
public List<XZQTreeNode> TreeList
{
get
{
List<DataDicTionary> dicList = Platform.Instance.DicHelper.GetDic(DicTypeEnum.QSDM, true);
if (dicList == null)
return null;
return GetTree(dicList);
}
}
#region 构造复选TreeView 王欢 2018-09-29
public List<XZQTreeNode> CheckBoxTreeList
{
get
{
//List<DataDicTionary> dicList = DicAPI.GetDic(DicTypeEnum.QSDM, true);
//if (dicList == null)
// return null;
//return GetTreeParent(dicList);
List<XZQTreeNode> XZQTreeNodeList = new List<XZQTreeNode>();
List<BasicDataModel> dicList = null;// Env.Instance.Platfrom.BasicData.GetXZQDic(1).ToList();
List<BasicDataModel> dicList2 = null;//Env.Instance.Platfrom.BasicData.GetXZQDicQC(2, true).ToList();
foreach (var item in dicList)
{
XZQTreeNode tvi = new XZQTreeNode();
tvi.XZQDM = item.Code;
tvi.XZQMC = item.Name;
tvi.Tag = item;
tvi.IsChecked = true;
tvi.GroupName = "XZQ";
foreach (var item2 in dicList2.Where(x => x.Code.Substring(0, 6) == item.Code))
{
XZQTreeNode tvi2 = new XZQTreeNode();
tvi2.XZQDM = item2.Code;
tvi2.XZQMC = item2.Name;
tvi2.Tag = item2;
tvi2.IsChecked = true;
tvi2.GroupName = "XZQ";
//Bug-16276 霍岩 2019-07-01 子节点的父级属性赋值
tvi2.Parent = tvi;
tvi.Nodes.Add(tvi2);
}
XZQTreeNodeList.Add(tvi);
}
return XZQTreeNodeList;
}
}
private List<XZQTreeNode> GetTreeParent(List<DataDicTionary> dicList)
{
try
{
var list = new List<XZQTreeNode>();
foreach (DataDicTionary item in dicList)
{
if (item.CODE.Length < 6 || item.CODE.Length > 12)
{
if (item.SubDic != null && item.SubDic.Count > 0)
{
list.AddRange(GetTreeParent(item.SubDic));
}
continue;
}
XZQTreeNode tvi = new XZQTreeNode();
tvi.XZQDM = item.CODE;
tvi.XZQMC = item.NAME;
tvi.Tag = item;
tvi.GroupName = "XZQ";
list.Add(tvi);
RecursiveAddChildren(tvi, item.SubDic);
tvi.IsExpanded = true;
}
list = list.OrderBy(x => x.XH).ToList();
return list;
}
catch (Exception ex)
{
LogAPI.Debug(ex);
}
return null;
}
private XZQTreeNode RecursiveAddChildren(XZQTreeNode parent, List<DataDicTionary> dicList)
{
try
{
//王欢 2018-12-11 系统日志报错问题
if (dicList == null)
{
return null;
}
//parent.Nodes = new List<XZQTreeNode>();
foreach (DataDicTionary item in dicList)
{
if (item == null)
{
continue;
}
if (item.CODE.Length < 6 || item.CODE.Length > 12)
{
continue;
}
XZQTreeNode tvi = new XZQTreeNode();
tvi.XZQDM = item.CODE;
tvi.XZQMC = item.NAME;
tvi.Tag = item;
tvi.GroupName = "XZQ";
tvi.Parent = parent;
parent.Nodes.Add(tvi);
RecursiveAddChildren(tvi, item.SubDic);
tvi.IsExpanded = true;
}
return parent;
}
catch (Exception ex)
{
LogAPI.Debug(ex);
}
return null;
}
#endregion
private List<XZQTreeNode> GetTree(List<DataDicTionary> dicList)
{
try
{
if (dicList == null)
return null;
List<XZQTreeNode> result = new List<XZQTreeNode>();
foreach (DataDicTionary dic in dicList)
{
if (dic.CODE.Length < 6 || dic.CODE.Length > 12)
{
if (dic.SubDic != null && dic.SubDic.Count > 0)
{
result.AddRange(GetTree(dic.SubDic));
}
continue;
}
var n1 = new XZQTreeNode();
n1.XZQDM = dic.CODE;
n1.XZQMC = dic.NAME;
n1.Tag = dic;
n1.GroupName = "XZQ";
result.Add(n1);
if (dic.SubDic != null && dic.SubDic.Count > 0)
{
n1.Nodes = GetTree(dic.SubDic);
}
if (n1.XZQDM.Length == 6)
{
n1.IsExpanded = true;
}
}
result = result.OrderBy(x => x.XH).ToList();
return result;
}
catch (Exception ex)
{
LogAPI.Debug(ex);
}
return null;
}
public ReportEntityClass GetReportEntityClass(ReportTypeEnum re)
{
var relist = GetReportEntityClassList();
return relist.FirstOrDefault(x => x.ReportType == re);
}
public ReportEntityClass GetWordReportEntityClass(ReportTypeEnum re)
{
var relist = GetReportlanguageOutEntityClassList();
return relist.FirstOrDefault(x => x.ReportType == re);
}
public void Export(ReportTypeEnum re)
{
IRDBHelper dbHelper = null;
try
{
if (string.IsNullOrWhiteSpace((MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).CODE))
{
MessageHelper.Show("县行政区划代码不能为空,请在工程属性界面中填写6位县区划代码!");
return;
}
int validateType = 0;
string connStr = SysConfigsOprator.GetDBConnectionByName("MDBOledbConnection");
string SourcePath = string.Format(connStr, (MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).GetProjFilePath(), "dic.mdb");
//创建数据库连接
dbHelper = RDBFactory.CreateDbHelper(SourcePath, DatabaseType.MSAccess);
//第一步:首先判断是否已经缓存过表
if (re != ReportTypeEnum.YJJBNTXZQKTJB)
{
string cjhzsqlsql = "select sum(TBZMJ) from MJHZJCTJB ";
DataTable cjmjhzdt = null;
try
{
cjmjhzdt = dbHelper.ExecuteDatatable("cjmjhz", cjhzsqlsql, true);
}
catch
{
}
//if (cjmjhzdt == null || cjmjhzdt.Rows.Count == 0 || cjmjhzdt.Rows[0][0].ToDecimal(2) != (Env.Instance.Project.LDKZMJ2 + Env.Instance.Project.HDKZMJ2).ToDecimal(2))
//{
// MessageHelper.Show("请先进行数据汇总!");
// return;
//}
}
ProgressHelper.ShowProcessBar("正在导出...");
StatisticalReportClass reportClass = new StatisticalReportClass();
reportClass.MjConvertValue = 1;
if (reportClass.MjConvertValue == 1)
{
reportClass.ReportFileType = ReportFileTypeEnum.DBGQ;
}
else
{
reportClass.ReportFileType = ReportFileTypeEnum.DBM;
}
string savepath = "temp\\export";
if (!System.IO.Directory.Exists(savepath))
{
System.IO.Directory.CreateDirectory(savepath);
}
ReportEntityClass reportEntity = GetReportEntityClass(re);
//Bug-13390 霍岩 2018-12-17 添加原路径文件名前加六位县行政区代码
string saveCurrentPath = savepath + "\\" + string.Format("({0})", (MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).CODE) + reportEntity.TempalateFileName + ".xlsx";
if (TreeList != null)
{
reportEntity.XZQTreeNode = TreeList[0];
}
bool isRst = reportClass.Export(saveCurrentPath, dbHelper, reportEntity);
ProgressHelper.CloseProcessBar();
if (isRst)
{
//启动主程序
System.Diagnostics.Process.Start(saveCurrentPath);
//MessageBox.Show("导出完成!");
}
else
{
MessageHelper.ShowError("导出失败!");
}
}
catch (Exception ex)
{
ProgressHelper.CloseProcessBar();
MessageHelper.ShowError("导出失败!");
LogAPI.Debug("导出失败:" + ex);
}
finally
{
ProgressHelper.CloseProcessBar();
if (dbHelper != null)
dbHelper.DisConnect();
}
}
#region IStatisticExport接口实现
public string OutPath
{
get;
set;
}
public ReportFileTypeEnum AreaUnit
{
get;
set;
}
ReportFileTypeEnum IStatisticExport.AreaUnit { get; set; }
public void ExportReport(ReportTypeEnum pReportType)
{
IRDBHelper dbHelper = null;
try
{
//RegionAuthorize regionAuthorize = new RegionAuthorize();
int validateType = 0;
//if (!regionAuthorize.ValidateAuthorizeByXZQDM(ref validateType))
//{
// if (validateType.Equals(1))
// {
// MessageHelper.ShowError("地类图斑数据区域授权未通过");
// }
// else if (validateType.Equals(2))
// {
// MessageHelper.ShowError("行政区数据区域授权未通过");
// }
// else
// {
// MessageHelper.ShowError("区域授权验证失败");
// }
// return;
//}
string connStr = SysConfigsOprator.GetDBConnectionByName("MDBOledbConnection");
string SourcePath = "";// string.Format(connStr, Env.Instance.Project.GetProjMDBPath());
//创建数据库连接
dbHelper = RDBFactory.CreateDbHelper(SourcePath, DatabaseType.MSAccess);
//第一步:首先判断是否已经缓存过表
string cjhzsqlsql = "select sum(TBZMJ) from MJHZJCTJB ";
DataTable cjmjhzdt = null;
try
{
cjmjhzdt = dbHelper.ExecuteDatatable("cjmjhz", cjhzsqlsql, true);
}
catch
{
}
//if (cjmjhzdt == null || cjmjhzdt.Rows.Count == 0 || cjmjhzdt.Rows[0][0].ToDecimal(2) != (Env.Instance.Project.LDKZMJ2 + Env.Instance.Project.HDKZMJ2).ToDecimal(2))
//{
// //MessageBox.Show("请先进行数据汇总!");
// LogAPI.Debug("请先进行数据汇总!");
// return;
//}
StatisticalReportClass reportClass = new StatisticalReportClass();
reportClass.ReportFileType = AreaUnit;
ReportEntityClass reportEntity = GetReportEntityClass(pReportType);
string saveCurrentPath = OutPath + ".xlsx";
if (TreeList != null)
{
reportEntity.XZQTreeNode = TreeList[0];
}
bool isRst = reportClass.Export(saveCurrentPath, dbHelper, reportEntity);
//ProgressHelper.CloseProcessBar();
}
catch (Exception ex)
{
//ProgressHelper.CloseProcessBar();
//MessageBox.Show("导出失败!");
LogAPI.Debug("导出失败:" + ex);
}
finally
{
//ProgressHelper.CloseProcessBar();
if (dbHelper != null)
dbHelper.DisConnect();
}
}
public void ExportWordReport(ReportTypeEnum pReportType)
{
IRDBHelper dbHelper = null;
try
{
StatisticalReportClass reportClass = new StatisticalReportClass();
reportClass.ReportFileType = AreaUnit;
ReportEntityClass reportEntity = GetWordReportEntityClass(pReportType);
string saveCurrentPath = OutPath + ".docx";
if (TreeList != null)
{
reportEntity.XZQTreeNode = TreeList[0];
}
bool isRst = reportClass.Export(saveCurrentPath, dbHelper, reportEntity, new System.Collections.Hashtable());
//ProgressHelper.CloseProcessBar();
}
catch (Exception ex)
{
//ProgressHelper.CloseProcessBar();
//MessageBox.Show("导出失败!");
LogAPI.Debug("导出失败:" + ex);
}
finally
{
//ProgressHelper.CloseProcessBar();
if (dbHelper != null)
dbHelper.DisConnect();
}
}
public void ExportBGNMKReport(ReportTypeEnum pReportType, string sNMKMDBPath)
{
IRDBHelper dbHelper = null;
try
{
string connStr = SysConfigsOprator.GetDBConnectionByName("MDBOledbConnection");
string sBGNMK_HZPCResults_MDBPath = sNMKMDBPath;
if (System.IO.File.Exists(sBGNMK_HZPCResults_MDBPath) == false)
{
MessageHelper.ShowError("未能找到变更年末库汇总平差结果,故汇总表格导出失败");
return;
}
string SourcePath = string.Format(connStr, sBGNMK_HZPCResults_MDBPath);
//创建数据库连接
dbHelper = RDBFactory.CreateDbHelper(SourcePath, DatabaseType.SQLite);
//第一步:首先判断是否已经缓存过表
string cjhzsqlsql = "select sum(TBZMJ) from MJHZJCTJB ";
DataTable cjmjhzdt = null;
try
{
cjmjhzdt = dbHelper.ExecuteDatatable("cjmjhz", cjhzsqlsql, true);
}
catch
{
}
//if (cjmjhzdt == null || cjmjhzdt.Rows.Count == 0 || cjmjhzdt.Rows[0][0].ToDecimal(2) != (Env.Instance.Project.LDKZMJ2 + Env.Instance.Project.HDKZMJ2).ToDecimal(2))
//{
// //MessageBox.Show("请先进行数据汇总!");
// LogAPI.Debug("请先进行数据汇总!");
// return;
//}
StatisticalReportClass reportClass = new StatisticalReportClass();
reportClass.ReportFileType = AreaUnit;
ReportEntityClass reportEntity = GetReportEntityClass(pReportType);
string saveCurrentPath = OutPath + ".xlsx";
if (TreeList != null)
{
reportEntity.XZQTreeNode = TreeList[0];
}
bool isRst = reportClass.Export(saveCurrentPath, dbHelper, reportEntity, sBGNMK_HZPCResults_MDBPath);
//ProgressHelper.CloseProcessBar();
}
catch (Exception ex)
{
//ProgressHelper.CloseProcessBar();
//MessageBox.Show("导出失败!");
LogAPI.Debug("导出失败:" + ex);
}
finally
{
//ProgressHelper.CloseProcessBar();
if (dbHelper != null)
dbHelper.DisConnect();
}
}
#endregion
}
}