年度变更建库软件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.
 
 

198 lines
8.2 KiB

using KGIS.Framework.Common;
using KGIS.Framework.Common.Interface;
using KGIS.Framework.DBOperator;
using KGIS.Framework.Platform;
using KGIS.Framework.Utils;
using kingo.Plugin.BGResultManager.Interface;
using Kingo.Plugin.BGResultManager.Utility;
using System;
using System.IO;
namespace Kingo.Plugin.BGResultManager.Services
{
/// <summary>
/// 报表服务
/// </summary>
public class ReportService : IReportService
{
/// <summary>
/// 导出变更统计报表
/// </summary>
/// <param name="pReportType"></param>
/// <param name="pExprotPath"></param>
public void ExportBGReport(EnumReportType pReportType, string pExprotPath)
{
try
{
string sTheElementEmptyExcelName = "";
string sFromPath_Temp = "";
BGReportBasicOperate iBGReportBasicOperate1 = new BGReportBasicOperate();
string sShowExcelPath = iBGReportBasicOperate1.GetShowExcelPath(pReportType);
if (File.Exists(sShowExcelPath) == false)
{
//MessageBox.Show("请先生成报表数据");
#region 拷贝空表
sTheElementEmptyExcelName = iBGReportBasicOperate1.GetExcelModelNameByBGReportType(pReportType);
sFromPath_Temp = AppDomain.CurrentDomain.BaseDirectory + "TempalateReports\\统一时点更新统计表\\原样表\\" + sTheElementEmptyExcelName;
if (File.Exists(sFromPath_Temp) == false)
{
//MessageHelper.Show(sReportName + "原文件 " + sTheElementEmptyExcelName + " 获取失败,故 报表生成 失败");
//LogAPI.Debug(sTheElementEmptyExcelName + " 原Excel模板 获取失败,故 报表生成 失败");
return;
}
File.Copy(sFromPath_Temp, pExprotPath + ".xlsx", true);//拷贝空表
#endregion
}
else
{
File.Copy(sShowExcelPath, pExprotPath + ".xlsx", true);
}
return;
}
catch (Exception ex)
{
LogAPI.Debug(string.Format("{0}导出时发生异常!异常信息如下:", pReportType.ToString()));
LogAPI.Debug(ex);
LogAPI.Debug("异常信息结束。");
}
}
/// <summary>
/// 导出变更统计报表
/// </summary>
/// <param name="pReportType"></param>
/// <param name="pExprotPath"></param>
public void ExportBGReportNEW(string saveCurrentPath, IRDBHelper dbHelper, string reportType, string ncsjPath)
{
try
{
ReportEntityClass reportEntityClass = new ReportEntityClass();
reportEntityClass.ReportType = (ReportTypeEnum)System.Enum.Parse(typeof(ReportTypeEnum), reportType);
StatisticalReportClass reportClass = new StatisticalReportClass();
reportClass.NULLExport(saveCurrentPath, dbHelper, reportEntityClass, ncsjPath);
return;
}
catch (Exception ex)
{
LogAPI.Debug(string.Format("{0}导出时发生异常!异常信息如下:", reportType));
LogAPI.Debug(ex);
LogAPI.Debug("异常信息结束。");
}
}
/// <summary>
/// 导出整库统计报表
/// </summary>
/// <param name="pReportType"></param>
/// <param name="pExprotPath"></param>
public void ExportZKReport(EnumReportType pReportType, string pExprotPath)
{
try
{
string sTheElementEmptyExcelName = "";
string sFromPath_Temp = "";
Utility.ZKReportBasicOperate iZKReportBasicOperate1 = new Utility.ZKReportBasicOperate();
string sShowExcelPath = iZKReportBasicOperate1.GetShowExcelPath(pReportType);
if (File.Exists(sShowExcelPath) == false)
{
//MessageBox.Show("请先生成报表数据");
#region 拷贝空表
sTheElementEmptyExcelName = iZKReportBasicOperate1.GetExcelModelNameByZKReportType(pReportType);
sFromPath_Temp = AppDomain.CurrentDomain.BaseDirectory + "TempalateReports\\整库统计表\\原样表\\" + sTheElementEmptyExcelName;
if (File.Exists(sFromPath_Temp) == false)
{
//MessageHelper.Show(sReportName + "原文件 " + sTheElementEmptyExcelName + " 获取失败,故 报表生成 失败");
//LogAPI.Debug(sTheElementEmptyExcelName + " 原Excel模板 获取失败,故 报表生成 失败");
return;
}
File.Copy(sFromPath_Temp, pExprotPath + ".xlsx", true);//拷贝空表
#endregion
}
else
{
File.Copy(sShowExcelPath, pExprotPath + ".xlsx", true);
}
return;
}
catch (Exception ex)
{
LogAPI.Debug(string.Format("{0}导出时发生异常!异常信息如下:", pReportType.ToString()));
LogAPI.Debug(ex);
LogAPI.Debug("异常信息结束。");
}
}
/// <summary>
/// 导出变更年末库
/// </summary>
/// <param name="pReportType"></param>
/// <param name="sNMKMDBPath"></param>
/// <param name="sPath"></param>
public void ExportBGNMKReport(string pReportType, string sNMKMDBPath, string sPath)
{
IStatisticExport exprotReport = new ExportHelper();
exprotReport.AreaUnit = ReportFileTypeEnum.DBGQ;
exprotReport.OutPath = sPath;
try
{
//exprotReport.ExportBGNMKReport((ReportTypeEnum)System.Enum.Parse(typeof(ReportTypeEnum), pReportType), sNMKMDBPath);
}
catch (Exception ex)
{
LogAPI.Debug(ex);
}
}
/// <summary>
/// 导出word
/// </summary>
/// <param name="pReportType"></param>
/// <param name="sPath"></param>
public void ExportWordReport(string pReportType, string sPath)
{
//IStatisticExport exprotReport2 = new ExportHelper();
//exprotReport2.AreaUnit = ReportFileTypeEnum.DBGQ;
//exprotReport2.OutPath = sPath;
//exprotReport2.ExportWordReport((ReportTypeEnum)System.Enum.Parse(typeof(ReportTypeEnum), pReportType));
}
/// <summary>
/// 初始化基础统计表(面积公顷)
/// </summary>
/// <param name="sNMK_MDBPath"></param>
/// <param name="path"></param>
public void InitMJHZJCTJBData(string sNMK_MDBPath, string path)
{
//NMKMJHZJCTJBHelper mjhzjctjbhelper = new NMKMJHZJCTJBHelper();
//mjhzjctjbhelper.NMK_MDBPath = sNMK_MDBPath;
//mjhzjctjbhelper.TempMDBPath = path;
//if ((MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).DCMJHD2>0)
//{
// mjhzjctjbhelper.InitMJHZJCTJBData((MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).DCMJ2.ToDecimal(), (MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).DCMJHD2.ToDecimal());
//}
//else
//{
// mjhzjctjbhelper.InitMJHZJCTJBData((MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).DCMJ2.ToDecimal(), 0);
//}
}
/// <summary>
/// 获取行政区字典
/// </summary>
/// <param name="pLevel"></param>
/// <returns></returns>
public BasicDataModel[] GetXZQDic(int pLevel)
{
try
{
return StatisticalReportClass.GetXZQDic(pLevel);
}
catch (Exception ex)
{
LogAPI.Debug(ex);
return null;
}
}
}
}