|
|
|
|
using ESRI.ArcGIS.Geodatabase;
|
|
|
|
|
using KGIS.Framework.AE;
|
|
|
|
|
using KGIS.Framework.AE.Enum;
|
|
|
|
|
using KGIS.Framework.Common;
|
|
|
|
|
using KGIS.Framework.Common.Interface;
|
|
|
|
|
using KGIS.Framework.Maps;
|
|
|
|
|
using KGIS.Framework.Platform;
|
|
|
|
|
using KGIS.Framework.Platform.Helper;
|
|
|
|
|
using KGIS.Framework.Utils;
|
|
|
|
|
using KGIS.Framework.Utils.Helper;
|
|
|
|
|
using KGIS.Framework.Utils.Model;
|
|
|
|
|
using kingo.Plugin.BGResultManager.Helper;
|
|
|
|
|
using kingo.Plugin.BGResultManager.Interface;
|
|
|
|
|
using kingo.Plugin.BGResultManager.Utility;
|
|
|
|
|
using kingo.Plugin.BGResultManager.Utility.MDB;
|
|
|
|
|
using kingo.Plugin.BGResultManager.Utility.Metadata;
|
|
|
|
|
using Kingo.Plugin.BGResultManager.Utility;
|
|
|
|
|
using Kingo.PluginServiceInterface;
|
|
|
|
|
using ReactiveUI;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Xml;
|
|
|
|
|
using UIShell.OSGi;
|
|
|
|
|
|
|
|
|
|
namespace Kingo.Plugin.BGResultManager.ViewModel
|
|
|
|
|
{
|
|
|
|
|
public class ExportViewModel : ReactiveObject, IScreen
|
|
|
|
|
{
|
|
|
|
|
private string _OutDir;
|
|
|
|
|
public string OutDir
|
|
|
|
|
{
|
|
|
|
|
get { return _OutDir; }
|
|
|
|
|
set { this.RaiseAndSetIfChanged(ref _OutDir, value); }
|
|
|
|
|
}
|
|
|
|
|
private bool _hasPdt;
|
|
|
|
|
public bool HasPDT
|
|
|
|
|
{
|
|
|
|
|
get { return _hasPdt; }
|
|
|
|
|
set { this.RaiseAndSetIfChanged(ref _hasPdt, value); }
|
|
|
|
|
}
|
|
|
|
|
private bool _IsBL;//是否补充0至19位
|
|
|
|
|
public bool IsBL
|
|
|
|
|
{
|
|
|
|
|
get { return _IsBL; }
|
|
|
|
|
set { this.RaiseAndSetIfChanged(ref _IsBL, value); }
|
|
|
|
|
}
|
|
|
|
|
public List<ResultsCatalog> Items { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 输出成果根目录
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string OutDataRootDir { get; set; }
|
|
|
|
|
public RoutingState Router
|
|
|
|
|
{
|
|
|
|
|
get;
|
|
|
|
|
}
|
|
|
|
|
public ReactiveCommand<object> ExportClick { get; protected set; }
|
|
|
|
|
public ExportViewModel()
|
|
|
|
|
{
|
|
|
|
|
HasPDT = false;
|
|
|
|
|
IsBL = false;
|
|
|
|
|
Items = GetResultsCatalogtemp();//由于权属代码功能没有完善,现需要调用权属功能位置写死,龙城区为例
|
|
|
|
|
ExportClick = ReactiveCommand.Create();
|
|
|
|
|
ExportClick.Subscribe(x =>
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (Items == null)
|
|
|
|
|
return;
|
|
|
|
|
if (string.IsNullOrWhiteSpace(OutDir))
|
|
|
|
|
{
|
|
|
|
|
MessageHelper.Show("请选择输出目录!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
ProgressHelper.ShowProcessBar("正在导出......");
|
|
|
|
|
OutDataRootDir = Items[0].Name;
|
|
|
|
|
CreateCatalogDir(Items);
|
|
|
|
|
|
|
|
|
|
ProgressHelper.CloseProcessBar();
|
|
|
|
|
MessageHelper.ShowTips("导出完成!");
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
ProgressHelper.CloseProcessBar();
|
|
|
|
|
MessageHelper.ShowError("导出失败:" + ex.Message);
|
|
|
|
|
LogAPI.Debug(ex);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
IReportService _ReportService = null;
|
|
|
|
|
|
|
|
|
|
private void CreateCatalogDir(List<ResultsCatalog> pCatalog)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (pCatalog == null) return;
|
|
|
|
|
List<DataDicTionary> qsDic = Platform.Instance.DicHelper.GetNoGroupDic(DicTypeEnum.QSDM);
|
|
|
|
|
foreach (ResultsCatalog item in pCatalog)
|
|
|
|
|
{
|
|
|
|
|
item.Path = item.Path.Replace("县行政区划代码6位", (MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).CODE);
|
|
|
|
|
item.Name = item.Name.Replace("县行政区划代码6位", (MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).CODE).Replace("年代代码4位", DateTime.Now.Year.ToString()).Replace("比例尺代码1位", (MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).ScaleCode);
|
|
|
|
|
if (item.IsChecked == false) continue;
|
|
|
|
|
string sPath = string.Empty;
|
|
|
|
|
switch (item.Type)
|
|
|
|
|
{
|
|
|
|
|
case "Directory":
|
|
|
|
|
ProgressHelper.ShowProcessBar(string.Format("正在创建目录:{0}", item.Name));
|
|
|
|
|
sPath = System.IO.Path.Combine(OutDir, item.Path);
|
|
|
|
|
if (!System.IO.Directory.Exists(sPath))
|
|
|
|
|
System.IO.Directory.CreateDirectory(sPath);
|
|
|
|
|
if (item.SubCatalog != null)
|
|
|
|
|
CreateCatalogDir(item.SubCatalog);
|
|
|
|
|
break;
|
|
|
|
|
case "MetadataFile":
|
|
|
|
|
sPath = System.IO.Path.Combine(OutDir, item.Path);
|
|
|
|
|
ProgressHelper.ShowProcessBar(string.Format("正在生成元数据【{0}】", item.Name));
|
|
|
|
|
ExportMetadata exportMetadata = new ExportMetadata();
|
|
|
|
|
exportMetadata.OutPath = System.IO.Path.GetDirectoryName(sPath);
|
|
|
|
|
exportMetadata.Scale = new ScaleCodeTable() { Scale = (MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).Scale, ScaleCode = (MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).ScaleCode };//周旺华 20190301 修复bug 从工程获取比例尺
|
|
|
|
|
exportMetadata.Export();
|
|
|
|
|
break;
|
|
|
|
|
case "MDBFile":
|
|
|
|
|
break;
|
|
|
|
|
case "CopyMDBFile":
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
sPath = System.IO.Path.Combine(OutDir, item.Path);
|
|
|
|
|
ProgressHelper.ShowProcessBar(string.Format("正在导出【{0}】", item.Name));
|
|
|
|
|
string sFilePath = System.IO.Path.Combine(OutDir, OutDataRootDir, item.CopyFile, System.IO.Path.GetFileName(sPath));
|
|
|
|
|
if (System.IO.File.Exists(sFilePath))
|
|
|
|
|
{
|
|
|
|
|
System.IO.File.Copy(sFilePath, sPath);
|
|
|
|
|
//处理原始格式数据下MDB文件中地类图斑层的BZ字段内容,以及删除土地权属区图层数据
|
|
|
|
|
IWorkspaceAPI wsAPI = new WorkspaceAPI(sPath, WorkspaceTypeEnum.MDBFile);
|
|
|
|
|
if (wsAPI != null)
|
|
|
|
|
{
|
|
|
|
|
wsAPI.CurrentWorkspace.ExecuteSQL("update DLTB set BZ=''");
|
|
|
|
|
//白明雅 2019-05-30 删除多余字段
|
|
|
|
|
wsAPI.CurrentWorkspace.ExecuteSQL("alter table DLTB drop COLUMN SJBZ");
|
|
|
|
|
wsAPI.DeleteFeatureClass("TDQSQ");
|
|
|
|
|
wsAPI.DeleteFeatureClass("YJGD");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ExportMDB exportMDB2 = new ExportMDB();
|
|
|
|
|
exportMDB2.OutPath = sPath;
|
|
|
|
|
exportMDB2.Export();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
throw ex;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case "CopyGDBFile":
|
|
|
|
|
break;
|
|
|
|
|
case "VCTFile":
|
|
|
|
|
ProgressHelper.ShowProcessBar(string.Format("正在导出【{0}】", item.Name));
|
|
|
|
|
sPath = System.IO.Path.Combine(OutDir, item.Path);
|
|
|
|
|
IVCTExport vctExport = new MDBToVCTWindow();
|
|
|
|
|
vctExport.OutPath = System.IO.Path.GetDirectoryName(sPath);
|
|
|
|
|
vctExport.Scale = new ScaleCodeTable() { Scale = (MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).Scale, ScaleCode = (MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).ScaleCode };//周旺华 20190301 修复bug 从工程获取比例尺
|
|
|
|
|
vctExport.ExportVCT(HasPDT);
|
|
|
|
|
break;
|
|
|
|
|
case "OwnerUnitCodeFile":
|
|
|
|
|
break;
|
|
|
|
|
case "ReportExcel":
|
|
|
|
|
ProgressHelper.ShowProcessBar(string.Format("正在导出【{0}】", item.Name));
|
|
|
|
|
sPath = System.IO.Path.Combine(OutDir, item.Path);
|
|
|
|
|
|
|
|
|
|
#region 旧方法
|
|
|
|
|
//IStatisticExport exprotReport = new ExportHelper();
|
|
|
|
|
//exprotReport.AreaUnit = ReportFileTypeEnum.DBGQ;
|
|
|
|
|
//exprotReport.OutPath = sPath;
|
|
|
|
|
//try
|
|
|
|
|
//{
|
|
|
|
|
// exprotReport.ExportReport((ReportTypeEnum)System.Enum.Parse(typeof(ReportTypeEnum), item.FileType));
|
|
|
|
|
//}
|
|
|
|
|
//catch (Exception ex)
|
|
|
|
|
//{
|
|
|
|
|
// MessageHelper.ShowCaution(string.Format("{0}导出失败", item.Name));
|
|
|
|
|
// LogAPI.Debug(ex);
|
|
|
|
|
//}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 调取服务实现导出
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (_ReportService == null)
|
|
|
|
|
_ReportService = BundleRuntime.Instance.GetFirstOrDefaultService<IReportService>();
|
|
|
|
|
if (_ReportService != null)
|
|
|
|
|
{
|
|
|
|
|
_ReportService.ExportZKReport((EnumReportType)System.Enum.Parse(typeof(EnumReportType), item.FileType), sPath);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug("未能获取到报表输出服务,无法进行报表输出!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug(ex);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case "ReportWord":
|
|
|
|
|
//ProgressHelper.ShowProcessBar(string.Format("正在导出【{0}】", item.Name));
|
|
|
|
|
//sPath = System.IO.Path.Combine(OutDir, item.Path);
|
|
|
|
|
//IStatisticExport exprotReport2 = new ExportHelper();
|
|
|
|
|
//exprotReport2.AreaUnit = ReportFileTypeEnum.DBGQ;
|
|
|
|
|
//exprotReport2.OutPath = sPath;
|
|
|
|
|
//exprotReport2.ExportWordReport((ReportTypeEnum)System.Enum.Parse(typeof(ReportTypeEnum), item.FileType));
|
|
|
|
|
//break;
|
|
|
|
|
case "ReportShap":
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug(ex);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void ExportFeature(IFeatureClass pInFeatureClass, string pPath)
|
|
|
|
|
{
|
|
|
|
|
IWorkspaceFactory pWorkspaceFactory = new ESRI.ArcGIS.DataSourcesFile.ShapefileWorkspaceFactoryClass();
|
|
|
|
|
string parentPath = pPath.Substring(0, pPath.LastIndexOf('\\'));
|
|
|
|
|
string fileName = pPath.Substring(pPath.LastIndexOf('\\') + 1, pPath.Length - pPath.LastIndexOf('\\') - 1);
|
|
|
|
|
|
|
|
|
|
//AE.WorkspaceAPI workspaceApi = new WorkspaceAPI(parentPath, AE.Enum.WorkspaceTypeEnum.ShapeFile);
|
|
|
|
|
//IWorkspaceName pWorkspaceName = workspaceApi.CurrentWorkspace as IWorkspaceName;
|
|
|
|
|
IWorkspaceName pWorkspaceName = pWorkspaceFactory.Create(parentPath, fileName, null, 0);
|
|
|
|
|
|
|
|
|
|
ESRI.ArcGIS.esriSystem.IName name = (ESRI.ArcGIS.esriSystem.IName)pWorkspaceName;
|
|
|
|
|
|
|
|
|
|
IWorkspace pOutWorkspace = (IWorkspace)name.Open();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IDataset pInDataset = pInFeatureClass as IDataset;
|
|
|
|
|
IFeatureClassName pInFCName = pInDataset.FullName as IFeatureClassName;
|
|
|
|
|
IWorkspace pInWorkspace = pInDataset.Workspace;
|
|
|
|
|
IDataset pOutDataset = pOutWorkspace as IDataset;
|
|
|
|
|
IWorkspaceName pOutWorkspaceName = pOutDataset.FullName as IWorkspaceName;
|
|
|
|
|
IFeatureClassName pOutFCName = new FeatureClassNameClass();
|
|
|
|
|
IDatasetName pDatasetName = pOutFCName as IDatasetName;
|
|
|
|
|
pDatasetName.WorkspaceName = pOutWorkspaceName;
|
|
|
|
|
pDatasetName.Name = "YJGD";
|
|
|
|
|
IFieldChecker pFieldChecker = new FieldCheckerClass();
|
|
|
|
|
pFieldChecker.InputWorkspace = pInWorkspace;
|
|
|
|
|
pFieldChecker.ValidateWorkspace = pOutWorkspace;
|
|
|
|
|
IFields pFields = pInFeatureClass.Fields;
|
|
|
|
|
IFields pOutFields;
|
|
|
|
|
IEnumFieldError pEnumFieldError;
|
|
|
|
|
pFieldChecker.Validate(pFields, out pEnumFieldError, out pOutFields);
|
|
|
|
|
IFeatureDataConverter pFeatureDataConverter = new FeatureDataConverterClass();
|
|
|
|
|
pFeatureDataConverter.ConvertFeatureClass(pInFCName, null, null, pOutFCName, null, pOutFields, "", 100, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 由于权属代码功能没有完善,现需要调用权属功能位置写死,龙城区为例
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public List<ResultsCatalog> GetResultsCatalogtemp()
|
|
|
|
|
{
|
|
|
|
|
List<ResultsCatalog> result = new List<ResultsCatalog>();
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
XmlDocument doc = new XmlDocument();
|
|
|
|
|
//string strPath = SysAppPath.GetCurrentAppPath();
|
|
|
|
|
//strPath += @"Configs\ResultsCatalogCfgForBG2.xml";
|
|
|
|
|
string strPath = SysAppPath.GetResultsCataCfgPath();
|
|
|
|
|
doc.Load(strPath);
|
|
|
|
|
XmlNode nodeDataCatalog = doc.SelectSingleNode("ResultsCatalog");
|
|
|
|
|
if (nodeDataCatalog == null)
|
|
|
|
|
return result;
|
|
|
|
|
foreach (XmlNode item in nodeDataCatalog.ChildNodes)
|
|
|
|
|
{
|
|
|
|
|
if (item.Name == "DataCatalog")
|
|
|
|
|
{
|
|
|
|
|
ResultsCatalog rootCatalog = new ResultsCatalog();
|
|
|
|
|
rootCatalog.Name = item.Attributes["Name"] == null ? "" : item.Attributes["Name"].Value;
|
|
|
|
|
rootCatalog.Path = rootCatalog.Name;
|
|
|
|
|
rootCatalog.Type = "Directory";
|
|
|
|
|
if (item.ChildNodes != null)
|
|
|
|
|
{
|
|
|
|
|
List<ResultsCatalog> tree = GetSubCatalog(item, rootCatalog);
|
|
|
|
|
if (rootCatalog.SubCatalog == null)
|
|
|
|
|
rootCatalog.SubCatalog = new List<ResultsCatalog>();
|
|
|
|
|
rootCatalog.SubCatalog.AddRange(tree);
|
|
|
|
|
}
|
|
|
|
|
rootCatalog.Path = rootCatalog.Path.Replace("*省", "吉林省");
|
|
|
|
|
rootCatalog.Name = rootCatalog.Name.Replace("*省", "吉林省");
|
|
|
|
|
rootCatalog.Path = rootCatalog.Path.Replace("*市", "朝阳市");
|
|
|
|
|
rootCatalog.Name = rootCatalog.Name.Replace("*市", "朝阳市");
|
|
|
|
|
rootCatalog.Path = rootCatalog.Path.Replace("*县", "龙城区");
|
|
|
|
|
rootCatalog.Name = rootCatalog.Name.Replace("*县", "龙城区");
|
|
|
|
|
rootCatalog.Path = rootCatalog.Path.Replace("县行政区划代码6位", (MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).CODE);
|
|
|
|
|
rootCatalog.Name = rootCatalog.Name.Replace("县行政区划代码6位", (MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).CODE).Replace("年代代码4位", DateTime.Now.Year.ToString()).Replace("比例尺代码1位", (MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).ScaleCode);
|
|
|
|
|
result.Add(rootCatalog);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug(ex);
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static List<ResultsCatalog> GetResultsCatalog()
|
|
|
|
|
{
|
|
|
|
|
List<ResultsCatalog> result = new List<ResultsCatalog>();
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
XmlDocument doc = new XmlDocument();
|
|
|
|
|
string strPath = SysAppPath.GetResultsCataCfgPath();
|
|
|
|
|
doc.Load(strPath);
|
|
|
|
|
XmlNode nodeDataCatalog = doc.SelectSingleNode("ResultsCatalog");
|
|
|
|
|
if (nodeDataCatalog == null)
|
|
|
|
|
return result;
|
|
|
|
|
List<DataDicTionary> qsDic = Platform.Instance.DicHelper.GetNoGroupDic(DicTypeEnum.QSDM);
|
|
|
|
|
if (qsDic == null)
|
|
|
|
|
{
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
foreach (XmlNode item in nodeDataCatalog.ChildNodes)
|
|
|
|
|
{
|
|
|
|
|
if (item.Name == "DataCatalog")
|
|
|
|
|
{
|
|
|
|
|
ResultsCatalog rootCatalog = new ResultsCatalog();
|
|
|
|
|
rootCatalog.Name = item.Attributes["Name"] == null ? "" : item.Attributes["Name"].Value;
|
|
|
|
|
rootCatalog.Path = rootCatalog.Name;
|
|
|
|
|
rootCatalog.Type = "Directory";
|
|
|
|
|
if (item.ChildNodes != null)
|
|
|
|
|
{
|
|
|
|
|
List<ResultsCatalog> tree = GetSubCatalog(item, rootCatalog);
|
|
|
|
|
if (rootCatalog.SubCatalog == null)
|
|
|
|
|
rootCatalog.SubCatalog = new List<ResultsCatalog>();
|
|
|
|
|
rootCatalog.SubCatalog.AddRange(tree);
|
|
|
|
|
}
|
|
|
|
|
if (qsDic != null)
|
|
|
|
|
{
|
|
|
|
|
DataDicTionary dic = qsDic.FirstOrDefault(f => f.CODE.Length == 2);
|
|
|
|
|
if (dic != null)
|
|
|
|
|
{
|
|
|
|
|
rootCatalog.Path = rootCatalog.Path.Replace("*省", dic.NAME);
|
|
|
|
|
rootCatalog.Name = rootCatalog.Name.Replace("*省", dic.NAME);
|
|
|
|
|
}
|
|
|
|
|
dic = qsDic.FirstOrDefault(f => f.CODE.Length == 4);
|
|
|
|
|
if (dic != null)
|
|
|
|
|
{
|
|
|
|
|
rootCatalog.Path = rootCatalog.Path.Replace("*市", dic.NAME);
|
|
|
|
|
rootCatalog.Name = rootCatalog.Name.Replace("*市", dic.NAME);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dic = qsDic.FirstOrDefault(f => f.CODE == (MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).CODE);
|
|
|
|
|
//dic = qsDic.FindLast(f => == Env.Instance.Project.CODE);
|
|
|
|
|
if (dic != null)
|
|
|
|
|
{
|
|
|
|
|
rootCatalog.Path = rootCatalog.Path.Replace("*县", dic.NAME);
|
|
|
|
|
rootCatalog.Name = rootCatalog.Name.Replace("*县", dic.NAME);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
rootCatalog.Path = rootCatalog.Path.Replace("县行政区划代码6位", (MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).CODE);
|
|
|
|
|
//rootCatalog.Name = rootCatalog.Name.Replace("县行政区划代码6位", Env.Instance.Project.CODE).Replace("年代代码4位", DateTime.Now.Year.ToString()).Replace("比例尺代码1位", "I");
|
|
|
|
|
rootCatalog.Name = rootCatalog.Name.Replace("县行政区划代码6位", (MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).CODE).Replace("年代代码4位", DateTime.Now.Year.ToString()).Replace("比例尺代码1位", (MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).ScaleCode);
|
|
|
|
|
result.Add(rootCatalog);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug(ex);
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static List<ResultsCatalog> GetSubCatalog(XmlNode pNode, ResultsCatalog pCatalog)
|
|
|
|
|
{
|
|
|
|
|
List<ResultsCatalog> result = new List<ResultsCatalog>();
|
|
|
|
|
if (pNode != null && pNode.ChildNodes != null)
|
|
|
|
|
{
|
|
|
|
|
string sPName = pNode.Attributes["Name"] == null ? "" : pNode.Attributes["Name"].Value.ToString();
|
|
|
|
|
if (string.IsNullOrWhiteSpace(sPName))
|
|
|
|
|
{
|
|
|
|
|
sPName = string.Empty;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//rootCatalog.Name = rootCatalog.Name.Replace("县行政区划代码6位", Env.Instance.Project.CODE).Replace("年代代码4位", DateTime.Now.Year.ToString()).Replace("比例尺代码1位", "I");
|
|
|
|
|
sPName = sPName.Replace("县行政区划代码6位", (MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).CODE).Replace("年代代码4位", DateTime.Now.Year.ToString()).Replace("比例尺代码1位", (MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).ScaleCode);
|
|
|
|
|
|
|
|
|
|
sPName = sPName.Replace("*省", "吉林省");
|
|
|
|
|
sPName = sPName.Replace("*市", "朝阳市");
|
|
|
|
|
sPName = sPName.Replace("*县", "龙城区");
|
|
|
|
|
|
|
|
|
|
#region 由于权属代码功能没有完善,现需要调用权属功能位置写死,龙城区为例,PS:下面的是原代码
|
|
|
|
|
//List<DataDicTionary> qsDic = DicAPI.GetNoGroupDic(DicTypeEnum.QSDM);
|
|
|
|
|
//if (qsDic != null)
|
|
|
|
|
//{
|
|
|
|
|
// DataDicTionary dic = qsDic.FirstOrDefault(f => f.CODE.Length == 2);
|
|
|
|
|
// if (dic != null)
|
|
|
|
|
// {
|
|
|
|
|
// sPName = sPName.Replace("*省", dic.NAME);
|
|
|
|
|
// }
|
|
|
|
|
// dic = qsDic.FirstOrDefault(f => f.CODE.Length == 4);
|
|
|
|
|
// if (dic != null)
|
|
|
|
|
// {
|
|
|
|
|
// sPName = sPName.Replace("*市", dic.NAME);
|
|
|
|
|
// }
|
|
|
|
|
// dic = qsDic.FirstOrDefault(f => f.CODE == (MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).CODE);
|
|
|
|
|
// if (dic != null)
|
|
|
|
|
// {
|
|
|
|
|
// sPName = sPName.Replace("*县", dic.NAME);
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
foreach (XmlNode item in pNode.ChildNodes)
|
|
|
|
|
{
|
|
|
|
|
ResultsCatalog catalog = new ResultsCatalog();
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (item.Attributes != null && item.Attributes["ShowFilter"] != null)
|
|
|
|
|
{
|
|
|
|
|
string[] showFilter = item.Attributes["ShowFilter"].Value.ToString().Split('_');
|
|
|
|
|
if (!(MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).CODE.StartsWith(showFilter[0]) && !sPName.StartsWith(showFilter[1]))
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catalog.Name = item.Attributes["Name"] == null ? "" : item.Attributes["Name"].Value;
|
|
|
|
|
catalog.Path = System.IO.Path.Combine(pCatalog.Path, catalog.Name);
|
|
|
|
|
catalog.CopyFile = item.Attributes["CopyFile"] == null ? "" : item.Attributes["CopyFile"].Value;
|
|
|
|
|
catalog.Type = item.Name;
|
|
|
|
|
catalog.Parent = pCatalog;
|
|
|
|
|
|
|
|
|
|
catalog.Path = catalog.Path.Replace("*省", "吉林省");
|
|
|
|
|
catalog.Name = catalog.Name.Replace("*省", "吉林省");
|
|
|
|
|
catalog.Path = catalog.Path.Replace("*市", "朝阳市");
|
|
|
|
|
catalog.Name = catalog.Name.Replace("*市", "朝阳市");
|
|
|
|
|
catalog.Path = catalog.Path.Replace("*县", "龙城区");
|
|
|
|
|
catalog.Name = catalog.Name.Replace("*县", "龙城区");
|
|
|
|
|
|
|
|
|
|
#region 由于权属代码功能没有完善,现需要调用权属功能位置写死,龙城区为例,PS:下面的是原代码
|
|
|
|
|
//if (qsDic != null)
|
|
|
|
|
//{
|
|
|
|
|
// DataDicTionary dic = qsDic.FirstOrDefault(f => f.CODE.Length == 2);
|
|
|
|
|
// if (dic != null)
|
|
|
|
|
// {
|
|
|
|
|
// catalog.Path = catalog.Path.Replace("*省", dic.NAME);
|
|
|
|
|
// catalog.Name = catalog.Name.Replace("*省", dic.NAME);
|
|
|
|
|
// }
|
|
|
|
|
// dic = qsDic.FirstOrDefault(f => f.CODE.Length == 4);
|
|
|
|
|
// if (dic != null)
|
|
|
|
|
// {
|
|
|
|
|
// catalog.Path = catalog.Path.Replace("*市", dic.NAME);
|
|
|
|
|
// catalog.Name = catalog.Name.Replace("*市", dic.NAME);
|
|
|
|
|
// }
|
|
|
|
|
// dic = qsDic.FirstOrDefault(f => f.CODE == (MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).CODE);
|
|
|
|
|
// if (dic != null)
|
|
|
|
|
// {
|
|
|
|
|
// catalog.Path = catalog.Path.Replace("*县", dic.NAME);
|
|
|
|
|
// catalog.Name = catalog.Name.Replace("*县", dic.NAME);
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
catalog.Path = catalog.Path.Replace("县行政区划代码6位", (MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).CODE);
|
|
|
|
|
//白明雅 2019-03-05 不写死
|
|
|
|
|
//catalog.Name = catalog.Name.Replace("县行政区划代码6位", Env.Instance.Project.CODE).Replace("年代代码4位", DateTime.Now.Year.ToString()).Replace("比例尺代码1位", "I");
|
|
|
|
|
catalog.Name = catalog.Name.Replace("县行政区划代码6位", (MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).CODE).Replace("年代代码4位", DateTime.Now.Year.ToString()).Replace("比例尺代码1位", (MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).ScaleCode);
|
|
|
|
|
|
|
|
|
|
result.Add(catalog);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{ }
|
|
|
|
|
if (item.ChildNodes != null)
|
|
|
|
|
{
|
|
|
|
|
if ("ReportExcel,ReportWord".Contains(item.Name))
|
|
|
|
|
{
|
|
|
|
|
ReadAttribute(item, catalog);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
catalog.SubCatalog = GetSubCatalog(item, catalog);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
private static void ReadAttribute(XmlNode pNode, ResultsCatalog pCatalog)
|
|
|
|
|
{
|
|
|
|
|
if (pNode != null && pNode.ChildNodes != null)
|
|
|
|
|
{
|
|
|
|
|
foreach (XmlNode item in pNode.ChildNodes)
|
|
|
|
|
{
|
|
|
|
|
switch (item.Name)
|
|
|
|
|
{
|
|
|
|
|
case "ReportType":
|
|
|
|
|
pCatalog.FileType = item.InnerText;
|
|
|
|
|
break;
|
|
|
|
|
case "TempalateFileName":
|
|
|
|
|
pCatalog.FileTempalate = item.InnerText;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|