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

168 lines
7.7 KiB

using ESRI.ArcGIS.Geodatabase;
using Kingo.RuleCheck.XJRuleCheck;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Reflection;
using System.Text;
namespace Kingo.RuleCheck
{
public class RuleCheckOpertion
{
/// <summary>
/// 省级单图斑建库和审核任务包检查
/// </summary>
/// <param name="dbPath"></param>
/// <param name="workspace"></param>
/// <param name="primityKey"></param>
/// <param name="excuteRules">系统设置-需执行规则</param>
/// <returns></returns>
public static List<RuleEntity> StartSJSHCheck(string dbPath, Dictionary<string, IFeatureClass> workspace, string primityKey = "", List<Tuple<string>> excuteRules = null)
{
if (!System.IO.File.Exists(dbPath) || workspace == null)
{
throw new Exception("输入参数错误");
}
//解密DB包
CheckHelper.DBToMDBHelper dBToMDBHelper = new CheckHelper.DBToMDBHelper();
DataTable dt = dBToMDBHelper.SJDecryptDB(dbPath, primityKey,out string tempDBPath);
List<RuleEntity> result = new List<RuleEntity>();
List<RuleType> ruleTypes = new List<RuleType>()
{
RuleType.,
RuleType.,
RuleType.,
RuleType.,
RuleType.,
//RuleType.单图斑建库人工检查,
RuleType.
};
DLParams.Init();
foreach (var item in ruleTypes)
{
//循环外业任务TBBSM检查
foreach (DataRow row in dt.Rows)
{
List<RuleEntity> rules = StartCheck(row[0] + string.Empty, tempDBPath, workspace, item, excuteRules);
if (rules != null && rules.Count > 0)
{
result.AddRange(rules);
}
}
}
return result;
}
/// <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> workspace, RuleType ruleType, List<Tuple<string>> excuteRules = null, List<string> disExecuteRules = null)
{
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 RGJCCheck();
break;
case RuleType.:
ruleCheck = new CZCSXCheck_DTB();
break;
}
if (ruleCheck != null)
{
ruleCheck.TBBSM = tbbsm;
ruleCheck.ExcuteRules = excuteRules;
ruleCheck.DisExecuteRules = disExecuteRules;
checkRst = ruleCheck.ExcuteCheck(tbbsm, sourcePath, workspace);
if (ruleType == RuleType.)
checkRst = ruleCheck.AllRGError;
}
return checkRst;
}
/// <summary>
/// 获取所有规则(20210721添加省级审核单图斑规则设置)
/// </summary>
/// <returns></returns>
public static List<Tuple<string, string>> GetAllRules()
{
List<Tuple<string, string>> lisRules = new List<Tuple<string, string>>();
Type trypInfo = typeof(DLSXYJZZPCheck_DTB);// Program为类名 地类属性与举证照片逻辑性检查
//获得方法名
MethodInfo[] methodInfo = trypInfo.GetMethods();
trypInfo.GetMethods().Select(m => m.Name).ToList().ForEach(x => lisRules.Add(new Tuple<string, string>(x, RuleType..ToString())));
trypInfo = typeof(SJJCCheck_DTB);// Program为类名 数学基础规范性检查
trypInfo.GetMethods().Select(m => m.Name).ToList().ForEach(x => lisRules.Add(new Tuple<string, string>(x, RuleType..ToString())));
trypInfo = typeof(TXSXCheck_DTB);// Program为类名 图形属性规范性检查
trypInfo.GetMethods().Select(m => m.Name).ToList().ForEach(x => lisRules.Add(new Tuple<string, string>(x, RuleType..ToString())));
trypInfo = typeof(TYLBBNLJXCheck_DTB);// Program为类名 通用类表内逻辑性检查
trypInfo.GetMethods().Select(m => m.Name).ToList().ForEach(x => lisRules.Add(new Tuple<string, string>(x, RuleType..ToString())));
trypInfo = typeof(TYLBJLJXCheck_DTB);// Program为类名 通用类表间逻辑性检查
trypInfo.GetMethods().Select(m => m.Name).ToList().ForEach(x => lisRules.Add(new Tuple<string, string>(x, RuleType..ToString())));
trypInfo = typeof(CZCSXCheck_DTB);// Program为类名 城镇村属性上图检查
trypInfo.GetMethods().Select(m => m.Name).ToList().ForEach(x => lisRules.Add(new Tuple<string, string>(x, RuleType..ToString())));
trypInfo = typeof(RuleCheckBase_DTB);// Program为类名
WLHRGChecker.DLRuleNames.Union(WLHRGChecker.CZCRuleNames).ToList().ForEach(x => lisRules.Add(new Tuple<string, string>(x, RuleType..ToString())));
var rules = lisRules.Where(x => !trypInfo.GetMethods().Select(m => m.Name).Contains(x.Item1)).Distinct().ToList();
rules.Sort((x, y) => x.Item2 == y.Item2 ? x.Item1.CompareTo(y.Item1) : x.Item2.CompareTo(y.Item2));
return rules;
}
/// <summary>
/// 县级预处理重叠检查
/// </summary>
/// <param name="dbPath"></param>
/// <param name="primityKey"></param>
/// <returns></returns>
public static List<RuleEntity> StartYCLCheck(string dbPath, string primityKey = "")
{
try
{
if (!System.IO.File.Exists(dbPath))
{
throw new Exception("输入参数错误");
}
return YCLOverlapCheck.YCLCheck(dbPath);
}
catch (Exception ex)
{
throw ex;
}
}
}
}