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

130 lines
5.7 KiB

4 months ago
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using ESRI.ArcGIS.Geodatabase;
namespace Kingo.RuleCheck
{
public class JZZPCheck : RuleCheckBase
{
List<string> ruleMethodNames = new List<string>() {
"WYZP001","WYJD001","WYDW001","WYLX001","WYJD002","WYZP003","WYZP004","JZBM001","JZZL001"
};
public override List<RuleEntity> ExcuteCheck(string sourePath, IWorkspace workspace)
{
return this.StartCheck(sourePath, workspace, ruleMethodNames);
}
public override List<RuleEntity> ExcuteCheck(IWorkspace workspace, List<string> layerNames, List<string> dataSetNames)
{
return this.StartCheck(workspace, ruleMethodNames, layerNames, dataSetNames);
}
public override List<RuleEntity> ExcuteCheck(string sourePath, Dictionary<string, IWorkspace> workspace)
{
return this.StartCheck(sourePath, workspace, ruleMethodNames);
}
public List<RuleEntity> WYZP001()
{
List<RuleEntity> result = new List<RuleEntity>();
try
{
System.Data.DataTable dataTable = this.mdbHelper.ExecuteDataTable($"SELECT * FROM (SELECT TBBSM,COUNT(1) AS GS FROM FJGX WHERE TBBSM IN (SELECT BSM FROM DTBDLTBGX A WHERE A.LJLX IS NULL OR A.LJLX='') GROUP BY TBBSM) WHERE GS<3 ");
if (dataTable != null && dataTable.Rows.Count > 0)
{
foreach (DataRow item in dataTable.Rows)
{
result.Add(new RuleEntity()
{
CheckObject = "外业举证照片",
ErrorId = item[0].ToString(),
ErrorTip = "非类举类型的外业图斑,举证照片总数不可少于3张",
ErrorType = "一类错误",
RuleCode = "WYZP001",
RuleName = "举证照片总数量检查",
RuleContent = "对于外业图斑,若图斑“未举证类型”为“空”时,举证照片总数少于3张时,判定为错误图斑。"
});
}
}
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "外业举证照片",
ErrorId = "规则检查失败:" + ex.Message,
ErrorTip = "非类举类型的外业图斑,举证照片总数不可少于3张",
ErrorType = "一类错误",
RuleCode = "WYZP001",
RuleName = "举证照片总数量检查",
RuleContent = "对于外业图斑,若图斑“未举证类型”为“空”时,举证照片总数少于3张时,判定为错误图斑。"
};
result.Add(ruleEntity);
}
return result;
}
public List<RuleEntity> WYJD001()
{
List<RuleEntity> result = new List<RuleEntity>();
try
{
string sql= "SELECT arg,POINTS_JSON FROM WYHCFJ";
System.Data.DataTable dataTable = this.mdbHelper.ExecuteDataTable(sql);
if (dataTable != null && dataTable.Rows.Count > 0)
{
foreach (DataRow item in dataTable.Rows)
{
string str = "pitch\":[0-9-]+";
Match match = Regex.Match(item[1].ToString(), str, RegexOptions.ECMAScript); //提取结果为2
Regex rg = new Regex("[0-9-]+");
var pitch= Convert.ToDouble(rg.Match(match.Value).Value);
if (pitch > 30 || pitch < -30)
{
result.Add(new RuleEntity()
{
CheckObject = "外业举证照片",
ErrorId = item[0].ToString(),
ErrorTip = "实地举证照片俯仰角度异常,请核查或重新拍照举证",
ErrorType = "二类错误",
RuleCode = "WYJD001",
RuleName = "举证特征照片俯仰角检查",
RuleContent = "对于外业实地举证照片,若举证照片的俯仰角度不属于水平线上下30度范围内,判定为错误照片。"
});
}
}
}
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "外业举证照片",
ErrorId = "规则检查失败:" + ex.Message,
ErrorTip = "实地举证照片俯仰角度异常,请核查或重新拍照举证",
ErrorType = "二类错误",
RuleCode = "WYJD001",
RuleName = "举证特征照片俯仰角检查",
RuleContent = "对于外业实地举证照片,若举证照片的俯仰角度不属于水平线上下30度范围内,判定为错误照片。"
};
result.Add(ruleEntity);
}
return result;
}
public List<RuleEntity> WYDW001()
{
List<RuleEntity> result = new List<RuleEntity>();
return result;
}
}
}