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

266 lines
11 KiB

6 months ago
using ESRI.ArcGIS.Geodatabase;
using Kingo.RuleCheck.AEHelper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Kingo.RuleCheck.XJRuleCheck
{
public class RuleCheckOpertion_DTB
{
/// <summary>
/// 县级单图斑建库和审核任务包检查
/// </summary>
/// <param name="dbPath"></param>
/// <param name="workspace"></param>
/// <param name="primityKey"></param>
/// <param name="excuteRules">系统设置-需执行规则</param>
/// <returns></returns>
public static List<RuleEntity> StartXJSHCheck(string tbbsm, string dbPath, List<BasicDataInfo> lstBasicDataInfo, string primityKey = "", List<Tuple<string>> excuteRules = null, EnumPC enumPC = EnumPC.TY)
{
List<IWorkspaceAPI> lstWorkapaceAPI = null;
Dictionary<string, IFeatureClass> dicFeatureClass = null;
try
{
if (!System.IO.File.Exists(dbPath) || lstBasicDataInfo == null || lstBasicDataInfo.Count <= 0)
{
throw new Exception("输入参数错误");
}
List<RuleEntity> result = new List<RuleEntity>();
List<RuleType> ruleTypes = new List<RuleType>()
{
RuleType.,
RuleType.,
RuleType.,
RuleType.,
RuleType.,
RuleType.
};
DLParams.Init();
dicFeatureClass = new Dictionary<string, IFeatureClass>();
lstWorkapaceAPI = new List<IWorkspaceAPI>();
foreach (var basicData in lstBasicDataInfo)
{
IWorkspaceAPI workspaceAPI = new WorkspaceAPI(basicData.WorkspacePath, basicData.WorkspaceType);
foreach (var item in basicData.FeatureClassName)
{
dicFeatureClass.Add(item.Key, workspaceAPI.OpenFeatureClass(item.Value).FeatureClass);
}
lstWorkapaceAPI.Add(workspaceAPI);
}
foreach (var item in ruleTypes)
{
List<RuleEntity> rules = StartCheck(tbbsm, dbPath, dicFeatureClass, item, excuteRules, new List<string> { "JZ005", "JZ007" }, enumPC);
if (rules != null && rules.Count > 0)
{
result.AddRange(rules);
}
}
return result;
}
catch (Exception ex)
{
throw ex;
}
finally
{
if (dicFeatureClass != null)
{
foreach (var item in dicFeatureClass)
{
if (item.Value != null)
{
System.Runtime.InteropServices.Marshal.ReleaseComObject(item.Value);
}
}
}
if (lstWorkapaceAPI != null)
{
foreach (var item in lstWorkapaceAPI)
{
item.CloseWorkspace();
}
}
}
}
public static List<RuleEntity> StartXJSHCheck(IFeature featureCk, List<BasicDataInfo> lstBasicDataInfo)
{
List<RuleEntity> result = new List<RuleEntity>();
return result;
}
/// <summary>
/// 县级单图斑建库和审核任务包检查
/// </summary>
/// <param name="tbbsm"></param>
/// <param name="dbPath"></param>
/// <param name="dicFeatureClass"></param>
/// <param name="excuteRules"></param>
/// <param name="disExecuteRules"></param>
/// <returns></returns>
public static List<RuleEntity> StartXJSHCheck(string tbbsm, string dbPath, Dictionary<string, IFeatureClass> dicFeatureClass, List<Tuple<string>> excuteRules = null, List<string> disExecuteRules = null, EnumPC enumPC = EnumPC.TY)
{
try
{
List<RuleEntity> result = new List<RuleEntity>();
List<RuleType> ruleTypes = new List<RuleType>()
{
RuleType.,
RuleType.,
RuleType.,
RuleType.,
RuleType.,
};
DLParams.Init();
foreach (var item in ruleTypes)
{
List<RuleEntity> rules = StartCheck(tbbsm, dbPath, dicFeatureClass, item, excuteRules, disExecuteRules, enumPC);
if (rules != null && rules.Count > 0)
{
result.AddRange(rules);
}
}
return result;
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
/// 县级单图斑建库和审核任务包检查(县级审核加载任务包时仅做二类错误检查)
/// </summary>
/// <param name="dbPath"></param>
/// <param name="workspace"></param>
/// <param name="primityKey"></param>
/// <param name="excuteRules">系统设置-需执行规则</param>
/// <returns></returns>
public static List<RuleEntity> StartXJSHCheckTypeTwoErrors(string tbbsm, string dbPath, List<BasicDataInfo> lstBasicDataInfo, string primityKey = "", List<Tuple<string>> excuteRules = null, EnumPC enumPC = EnumPC.TY)
{
List<IWorkspaceAPI> lstWorkapaceAPI = null;
Dictionary<string, IFeatureClass> dicFeatureClass = null;
try
{
if (!System.IO.File.Exists(dbPath) || lstBasicDataInfo == null || lstBasicDataInfo.Count <= 0)
{
throw new Exception("输入参数错误");
}
excuteRules = new List<Tuple<string>>
{
new Tuple<string>("LNGD"),
new Tuple<string>("HFSX"),
new Tuple<string>("DDTC20X"),
new Tuple<string>("TX002"),
new Tuple<string>("TXSXJC"),
new Tuple<string>("TX02X"),
};
List<RuleEntity> result = new List<RuleEntity>();
List<RuleType> ruleTypes = new List<RuleType>()
{
RuleType.,
RuleType.,
RuleType.,
RuleType.,
RuleType.,
};
DLParams.Init();
dicFeatureClass = new Dictionary<string, IFeatureClass>();
lstWorkapaceAPI = new List<IWorkspaceAPI>();
foreach (var basicData in lstBasicDataInfo)
{
IWorkspaceAPI workspaceAPI = new WorkspaceAPI(basicData.WorkspacePath, basicData.WorkspaceType);
foreach (var item in basicData.FeatureClassName)
{
dicFeatureClass.Add(item.Key, workspaceAPI.OpenFeatureClass(item.Value).FeatureClass);
}
lstWorkapaceAPI.Add(workspaceAPI);
}
foreach (var item in ruleTypes)
{
List<RuleEntity> rules = StartCheck(tbbsm, dbPath, dicFeatureClass, item, excuteRules, new List<string> { "JZ005", "JZ007" }, enumPC);
if (rules != null && rules.Count > 0)
{
result.AddRange(rules);
}
}
return result;
}
catch (Exception ex)
{
throw ex;
}
finally
{
if (dicFeatureClass != null)
{
foreach (var item in dicFeatureClass)
{
if (item.Value != null)
{
System.Runtime.InteropServices.Marshal.ReleaseComObject(item.Value);
}
}
}
if (lstWorkapaceAPI != null)
{
foreach (var item in lstWorkapaceAPI)
{
item.CloseWorkspace();
}
}
}
}
/// <summary>
/// 开始检查
/// </summary>
/// <param name="sourcePath"></param>
/// <param name="workspace"></param>
/// <param name="ruleType"></param>
/// <param name="excuteRules">系统设置-需执行规则</param>
/// <param name="disExecuteRules">不执行规则</param>
/// <returns></returns>
public static List<RuleEntity> StartCheck(string tbbsm, string sourcePath, Dictionary<string, IFeatureClass> dicFeatureClass, RuleType ruleType, List<Tuple<string>> excuteRules = null, List<string> disExecuteRules = null, EnumPC enumPC = EnumPC.TY)
{
List<RuleEntity> checkRst = new List<RuleEntity>();
RuleCheckBase_DTB ruleCheck = null;
switch (ruleType)
{
case RuleType.:
ruleCheck = new DLSXYJZZPCheck_DTB();
break;
case RuleType.:
ruleCheck = new SJJCCheck_DTB();
break;
case RuleType.:
ruleCheck = new TXSXCheck_DTB();
break;
case RuleType.:
ruleCheck = new TYLBBNLJXCheck_DTB();
break;
case RuleType.:
ruleCheck = new TYLBJLJXCheck_DTB();
break;
case RuleType.:
ruleCheck = new CZCSXCheck_DTB();
break;
}
if (ruleCheck != null)
{
ruleCheck.TBBSM = tbbsm;
ruleCheck.PC = enumPC;
ruleCheck.ExcuteRules = excuteRules;
ruleCheck.DisExecuteRules = disExecuteRules;
checkRst = ruleCheck.ExcuteCheck(tbbsm, sourcePath, dicFeatureClass);
if (ruleType == RuleType.)
checkRst = ruleCheck.AllRGError;
}
return checkRst;
}
}
}