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

1075 lines
55 KiB

using ESRI.ArcGIS.Geodatabase;
using ESRI.ArcGIS.Geometry;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
namespace Kingo.RuleCheck
{
/// <summary>
/// 通用类表间逻辑性检查
/// </summary>
public class TYLBJLJXCheck : RuleCheckBase
{
List<string> ruleMethodNames = new List<string>() {
"LS101","GFB101","TTQ101","CCWJQ101","DDTC101","DDTC102","LMFW101","LMFW102","CZC101","CZC102","CZC103","GD103","HDGD001","TTQ001"
,"LNGD001","LNGD002","LNGD003","LNGD004","HFSX001","HFSX002","HFSX003"
};
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);
}
/// <summary>
/// 临时用地上图范围检查(临时用地图斑上图范围需与地类图斑层相应图斑范围保持一致。)
/// </summary>
/// <returns></returns>
public List<RuleEntity> LS101()
{
List<RuleEntity> rst = new List<RuleEntity>();
try
{
string sql = $"select BSM from DTBDLTBGX where DDTCBZ='1301' AND bsm NOT IN (SELECT BSM FROM DTBLSYDGX)";
DataTable dt = mdbHelper.ExecuteDataTable(sql);
if (dt == null || dt.Rows.Count <= 0)
return null;
foreach (DataRow item in dt.Rows)
{
rst.Add(new RuleEntity()
{
CheckObject = "DTBLSYDGX",
ErrorId = $"{item["BSM"].ToString()}",
ErrorTip = "临时用地图斑上图范围需与地类图斑层相应图斑范围保持一致。",
ErrorType = "一类错误",
RuleCode = "LS101",
RuleName = "临时用地上图范围检查",
RuleContent = "通过DTBDLTBGX层中,“单独图层代码”为“1301”的图斑“标识码”字段,其均需位于DTBLSYDGX表中的“关联图斑标识码”字段中;否则,认定为错误图斑。"
});
}
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "DTBLSYDGX",
ErrorId = "规则检查失败:" + ex.Message,
ErrorTip = "临时用地图斑上图范围需与地类图斑层相应图斑范围保持一致。",
ErrorType = "一类错误",
RuleCode = "LS101",
RuleName = "临时用地上图范围检查",
RuleContent = "通过DTBDLTBGX层中,“单独图层代码”为“1301”的图斑“标识码”字段,其均需位于DTBLSYDGX表中的“关联图斑标识码”字段中;否则,认定为错误图斑。"
};
rst.Add(ruleEntity);
}
return rst;
}
///// <summary>
///// 不在省级临时用地备案范围内的临时用地图斑不可上单独图层
///// </summary>
///// <returns></returns>
//public List<RuleEntity> LS102()
//{
// IFeatureWorkspace lsydWorkspace = null;
// IFeatureClass lsydFeatureClass = null;
// List<RuleEntity> rst = new List<RuleEntity>();
// try
// {
// if (WorkspaceDic.ContainsKey("LSYD"))
// {
// lsydWorkspace = WorkspaceDic["LSYD"] as IFeatureWorkspace;
// lsydFeatureClass = lsydWorkspace.OpenFeatureClass("LSYD");
// }
// else
// {
// //不存在省级下发临时用地范围,则全部判定位错误图斑
// string sql = $"SELECT BSM FROM DTBDLTBGX WHERE DDTCBZ='1301' ";
// DataTable dt = mdbHelper.ExecuteDataTable(sql);
// if (dt == null || dt.Rows.Count <= 0)
// return null;
// foreach (DataRow item in dt.Rows)
// {
// rst.Add(new RuleEntity()
// {
// CheckObject = "DTBDLTBGX",
// ErrorId = $"{item["BSM"].ToString()}",
// ErrorTip = "不在省级临时用地备案范围内的临时用地图斑不可上单独图层",
// ErrorType = "一类错误",
// RuleCode = "LS102",
// RuleName = "临时用地上图范围检查",
// RuleContent = "将DTBLSYDGX层图斑与省级临时用地备案范围进行叠加,若重叠部分占DTBLSYDGX层图斑面积比例小于70%,认定为错误图斑"
// });
// }
// return rst;
// }
// //待实现
// if (sourceWorkSpace == null) return null;
// bool isExist = (sourceWorkSpace as IWorkspace2).get_NameExists(esriDatasetType.esriDTFeatureClass, "DTBDLTBGX");
// if (!isExist)
// {
// return null;
// }
// IFeatureClass pFeatureClass = (sourceWorkSpace as IFeatureWorkspace).OpenFeatureClass("DTBDLTBGX");
// //判断如果图层没有数据则跳过
// if (pFeatureClass.FeatureCount(null) <= 0)
// {
// return null;
// }
// IQueryFilter queryFilter = new QueryFilterClass()
// {
// WhereClause = " DDTCBZ='1301' "
// };
// IFeatureCursor featureCursor = pFeatureClass.Search(queryFilter, true);
// IFeature feature = null;
// ISpatialFilter geoFilter = new SpatialFilterClass();
// geoFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;
// int fieldIndex = pFeatureClass.FindField("BSM");
// while ((feature = featureCursor.NextFeature()) != null)
// {
// geoFilter.Geometry = feature.ShapeCopy;
// IFeatureCursor lsydCursor = lsydFeatureClass.Search(geoFilter, false);
// IFeature lsydFeature = null;
// double intersectArea = 0;
// while ((lsydFeature = lsydCursor.NextFeature()) != null)
// {
// IGeometry geo = this.InterSect(feature.ShapeCopy, lsydFeature.ShapeCopy);
// if (geo == null) continue;
// intersectArea += (geo as IArea).Area;
// }
// double gxMj = (feature.ShapeCopy as IArea).Area;
// if (intersectArea / gxMj < 0.7)
// {
// rst.Add(new RuleEntity()
// {
// CheckObject = "DTBDLTBGX",
// ErrorId = feature.Value[fieldIndex].ToString(),
// ErrorTip = "不在省级临时用地备案范围内的临时用地图斑不可上单独图层",
// ErrorType = "一类错误",
// RuleCode = "LS102",
// RuleName = "临时用地上图范围检查",
// RuleContent = "将DTBLSYDGX层图斑与省级临时用地备案范围进行叠加,若重叠部分占DTBLSYDGX层图斑面积比例小于70%,认定为错误图斑"
// });
// }
// }
// }
// catch (Exception ex)
// {
// RuleEntity ruleEntity = new RuleEntity()
// {
// ErrorId = "规则检查失败:" + ex.Message,
// CheckObject = "DTBDLTBGX",
// ErrorTip = "不在省级临时用地备案范围内的临时用地图斑不可上单独图层",
// ErrorType = "一类错误",
// RuleCode = "LS102",
// RuleName = "临时用地上图范围检查",
// RuleContent = "将DTBLSYDGX层图斑与省级临时用地备案范围进行叠加,若重叠部分占DTBLSYDGX层图斑面积比例小于70%,认定为错误图斑"
// };
// rst.Add(ruleEntity);
// }
// return rst;
//}
/// <summary>
/// 光伏板区图斑上图范围(光伏板区图斑上图范围需与地类图斑层相应图斑范围保持一致)
/// </summary>
/// <returns></returns>
public List<RuleEntity> GFB101()
{
List<RuleEntity> rst = new List<RuleEntity>();
try
{
string sql = $"select BSM from DTBDLTBGX where DDTCBZ='1302' AND bsm NOT IN (SELECT BSM FROM DTBGFBQGX)";
DataTable dt = mdbHelper.ExecuteDataTable(sql);
if (dt == null || dt.Rows.Count <= 0)
return null;
foreach (DataRow item in dt.Rows)
{
rst.Add(new RuleEntity()
{
CheckObject = "DTBGFBQGX",
ErrorId = $"{item["BSM"].ToString()}",
ErrorTip = "光伏板区图斑上图范围需与地类图斑层相应图斑范围保持一致。",
ErrorType = "一类错误",
RuleCode = "GFB101",
RuleName = "光伏板区上图范围检查",
RuleContent = "通过DTBDLTBGX层中,“单独图层代码”为“1302”的图斑“标识码”字段,其均需位于DTBGFBQGX表中的“标识码”字段中;否则,认定为错误图斑。"
});
}
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "DTBGFBQGX",
ErrorId = "规则检查失败:" + ex.Message,
ErrorTip = "光伏板区图斑上图范围需与地类图斑层相应图斑范围保持一致。",
ErrorType = "一类错误",
RuleCode = "GFB101",
RuleName = "光伏板区上图范围检查",
RuleContent = "通过DTBDLTBGX层中,“单独图层代码”为“1302”的图斑“标识码”字段,其均需位于DTBGFBQGX表中的“标识码”字段中;否则,认定为错误图斑。"
};
rst.Add(ruleEntity);
}
return rst;
}
/// <summary>
/// 推土区区图斑上图范围(推土区区图斑上图范围需与地类图斑层相应图斑范围保持一致)
/// </summary>
/// <returns></returns>
public List<RuleEntity> TTQ101()
{
List<RuleEntity> rst = new List<RuleEntity>();
try
{
string sql = $"select BSM from DTBDLTBGX where DDTCBZ='1303' AND bsm NOT IN (SELECT BSM FROM DTBTTQGX)";
DataTable dt = mdbHelper.ExecuteDataTable(sql);
if (dt == null || dt.Rows.Count <= 0)
return null;
foreach (DataRow item in dt.Rows)
{
rst.Add(new RuleEntity()
{
CheckObject = "DTBTTQGX",
ErrorId = $"{item["BSM"].ToString()}",
ErrorTip = "推土区图斑上图范围需与地类图斑层相应图斑范围保持一致。",
ErrorType = "一类错误",
RuleCode = "TTQ101",
RuleName = "推土区上图范围检查",
RuleContent = "通过DTBDLTBGX层中,“单独图层代码”为“1303”的图斑“标识码”字段,其均需位于DTBTTQGX表中的“标识码”字段中;否则,认定为错误图斑。"
});
}
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "DTBTTQGX",
ErrorId = "规则检查失败:" + ex.Message,
ErrorTip = "推土区图斑上图范围需与地类图斑层相应图斑范围保持一致。",
ErrorType = "一类错误",
RuleCode = "TTQ101",
RuleName = "推土区上图范围检查",
RuleContent = "通过DTBDLTBGX层中,“单独图层代码”为“1303”的图斑“标识码”字段,其均需位于DTBTTQGX表中的“标识码”字段中;否则,认定为错误图斑。"
};
rst.Add(ruleEntity);
}
return rst;
}
/// <summary>
/// 拆除未尽区图斑上图范围(拆除未尽区图斑上图范围需与地类图斑层相应图斑范围保持一致)
/// </summary>
/// <returns></returns>
public List<RuleEntity> CCWJQ101()
{
List<RuleEntity> rst = new List<RuleEntity>();
try
{
string sql = $"select BSM from DTBDLTBGX where DDTCBZ='1304' AND bsm NOT IN (SELECT BSM FROM DTBCCWJQGX)";
DataTable dt = mdbHelper.ExecuteDataTable(sql);
if (dt == null || dt.Rows.Count <= 0)
return null;
foreach (DataRow item in dt.Rows)
{
rst.Add(new RuleEntity()
{
CheckObject = "DTBCCWJQGX",
ErrorId = $"{item["BSM"].ToString()}",
ErrorTip = "拆除未尽区图斑上图范围需与地类图斑层相应图斑范围保持一致。",
ErrorType = "一类错误",
RuleCode = "CCWJQ101",
RuleName = "拆除未尽区上图范围检查",
RuleContent = "通过DTBDLTBGX层中,“单独图层代码”为“1304”的图斑“标识码”字段,其均需位于DTBCCWJQGX表中的“标识码”字段中;否则,认定为错误图斑。"
});
}
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "DTBCCWJQGX",
ErrorId = "规则检查失败:" + ex.Message,
ErrorTip = "拆除未尽区图斑上图范围需与地类图斑层相应图斑范围保持一致。",
ErrorType = "一类错误",
RuleCode = "CCWJQ101",
RuleName = "拆除未尽区上图范围检查",
RuleContent = "通过DTBDLTBGX层中,“单独图层代码”为“1304”的图斑“标识码”字段,其均需位于DTBCCWJQGX表中的“标识码”字段中;否则,认定为错误图斑。"
};
rst.Add(ruleEntity);
}
return rst;
}
/// <summary>
/// 单独图层多余上图检查(未标记单独图层的地类图斑处不应存在单独图层)
/// </summary>
/// <returns></returns>
public List<RuleEntity> DDTC101()
{
string sql = string.Empty;
List<RuleEntity> rst = new List<RuleEntity>();
try
{
List<string> dltcTableNames = new List<string>() { "DTBLSYDGX", "DTBGFBQGX", "DTBTTQGX", "DTBCCWJQGX", "DTBLMFWGX" };
foreach (string item in dltcTableNames)
{
sql = $"SELECT BSM FROM {item} WHERE BSM NOT IN (SELECT BSM FROM DTBDLTBGX WHERE DDTCBZ is not null and DDTCBZ<>'') ";
DataTable dt = mdbHelper.ExecuteDataTable(sql);
if (dt == null || dt.Rows.Count <= 0)
continue;
foreach (DataRow row in dt.Rows)
{
rst.Add(new RuleEntity()
{
CheckObject = item,
ErrorId = $"{row["BSM"].ToString()}",
ErrorTip = $"【{item}】未标记单独图层的地类图斑处不应存在单独图层",
ErrorType = "一类错误",
RuleCode = "DDTC101",
RuleName = "单独图层多余上图检查",
RuleContent = "对于DTBDLTBGX层未标记“单独图层代码”字段的图斑,若相应位置处存在DTBLSYDGX层、DTBGFBQGX层、DTBTTQGX层、DTBCCWJQGX层、DTBLMFWGX层图斑,认定为错误图斑"
});
}
}
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "DTBDLTBGX层",
ErrorId = "规则检查失败:" + ex.Message,
ErrorTip = "【单独图层】未标记单独图层的地类图斑处不应存在单独图层",
ErrorType = "一类错误",
RuleCode = "DDTC101",
RuleName = "单独图层多余上图检查",
RuleContent = "对于DTBDLTBGX层未标记“单独图层代码”字段的图斑,若相应位置处存在DTBLSYDGX层、DTBGFBQGX层、DTBTTQGX层、DTBCCWJQGX层、DTBLMFWGX层图斑,认定为错误图斑"
};
rst.Add(ruleEntity);
}
return rst;
}
/// <summary>
/// 单独图层重叠情况检查
/// </summary>
/// <returns></returns>
public List<RuleEntity> DDTC102()
{
List<RuleEntity> rst = new List<RuleEntity>();
try
{
Dictionary<string, string> dicBsmLName = new Dictionary<string, string>();
string sql = $"select BSM,LNAME from (select BSM,'DTBLSYDGX' as LNAME from DTBLSYDGX UNION select BSM,'DTBGFBQGX' as LNAME from DTBGFBQGX UNION select BSM,'DTBTTQGX' as LNAME from DTBTTQGX UNION select BSM,'DTBCCWJQGX' as LNAME from DTBCCWJQGX UNION select BSM,'DTBLMFWGX' as LNAME from DTBLMFWGX) where BSM in (select BSM from DTBDLTBGX where DDTCBZ<>'')";
DataTable dt = mdbHelper.ExecuteDataTable(sql);
if (dt == null || dt.Rows.Count <= 0)
return null;
foreach (DataRow item in dt.Rows)
{
string bsm = item[0] + string.Empty;
string lname = item[1] + string.Empty;
if (dicBsmLName.ContainsKey(bsm))
{
rst.Add(new RuleEntity()
{
CheckObject = "DTBLSYDGX层(表)、DTBGFBQGX层(表)、DTBTTQGX层(表)、DTBCCWJQGX层(表)、DTBLMFWGX层(表)",
ErrorId = $"{item["BSM"].ToString()}",
ErrorTip = $"【{lname}】与【{dicBsmLName[bsm]}】存在重叠",
ErrorType = "一类错误",
RuleCode = "DDTC102",
RuleName = "单独图层重叠情况检查",
RuleContent = "通过DLTDLTBGX层中“单独图层代码”不为空的图斑,依据其“标识码”,查看其“标识码”是否同时位于DTBLSYDGX层、DTBGFBQGX层、DTBTTQGX层、DTBCCWJQGX层、DTBLMFWGX层中两个以上图层的标识码字段中,若存在,认定为错误图斑。"
});
continue;
}
dicBsmLName[bsm] = lname;
}
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "DTBLSYDGX层(表)、DTBGFBQGX层(表)、DTBTTQGX层(表)、DTBCCWJQGX层(表)、DTBLMFWGX层(表)",
ErrorId = "规则检查失败:" + ex.Message,
ErrorTip = "【单独图层】与【单独图层】存在重叠",
ErrorType = "一类错误",
RuleCode = "DDTC102",
RuleName = "单独图层重叠情况检查",
RuleContent = "通过DLTDLTBGX层中“单独图层代码”不为空的图斑,依据其“标识码”,查看其“标识码”是否同时位于DTBLSYDGX层、DTBGFBQGX层、DTBTTQGX层、DTBCCWJQGX层、DTBLMFWGX层中两个以上图层的标识码字段中,若存在,认定为错误图斑。"
};
rst.Add(ruleEntity);
}
return rst;
}
/// <summary>
/// 路面范围图层上图检查
/// </summary>
/// <returns></returns>
public List<RuleEntity> LMFW101()
{
List<RuleEntity> rst = new List<RuleEntity>();
try
{
string sql = $"select BSM from DTBDLTBGX where DDTCBZ='1305' AND bsm NOT IN (SELECT BSM FROM DTBLMFWGX)";
DataTable dt = mdbHelper.ExecuteDataTable(sql);
if (dt == null || dt.Rows.Count <= 0)
return null;
foreach (DataRow item in dt.Rows)
{
rst.Add(new RuleEntity()
{
CheckObject = "DTBLMFWGX",
ErrorId = $"{item["BSM"].ToString()}",
ErrorTip = "路面范围图层范围应与公路图斑和铁路图斑范围相一致。",
ErrorType = "一类错误",
RuleCode = "LMFW101",
RuleName = "路面范围图层上图检查",
RuleContent = "通过DTBDLTBGX层中,“单独图层代码”为“1305”的图斑“标识码”字段,均需位于DTBLMFWGX表中的“标识码”字段中;否则,认定为错误图斑。"
});
}
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "DTBLMFWGX",
ErrorId = "规则检查失败:" + ex.Message,
ErrorTip = "路面范围图层范围应与公路图斑和铁路图斑范围相一致。",
ErrorType = "一类错误",
RuleCode = "LMFW101",
RuleName = "路面范围图层上图检查",
RuleContent = "通过DTBDLTBGX层中,“单独图层代码”为“1305”的图斑“标识码”字段,均需位于DTBLMFWGX表中的“标识码”字段中;否则,认定为错误图斑。"
};
rst.Add(ruleEntity);
}
return rst;
}
/// <summary>
/// 路面范围图层地类编码逻辑性检查
/// </summary>
/// <returns></returns>
public List<RuleEntity> LMFW102()
{
List<RuleEntity> rst = new List<RuleEntity>();
try
{
string sql = $"SELECT A.BSM FROM DTBLMFWGX A LEFT JOIN DTBDLTBGX B ON A.BSM=B.BSM WHERE B.DDTCBZ='1305' AND A.DLBM<>B.DLBM ";
DataTable dt = mdbHelper.ExecuteDataTable(sql);
if (dt == null || dt.Rows.Count <= 0)
return null;
foreach (DataRow item in dt.Rows)
{
rst.Add(new RuleEntity()
{
CheckObject = "DTBLMFWGX",
ErrorId = $"{item["BSM"].ToString()}",
ErrorTip = "路面范围图层需与相应地类图斑地类编码保持一致",
ErrorType = "一类错误",
RuleCode = "LMFW102",
RuleName = "路面范围图层地类编码逻辑性检查",
RuleContent = "若DTBLMFWGX层地类编码与相应位置处的DTBDLTBGX层地类编码不一致,认定为错误图斑"
});
}
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "DTBLMFWGX",
ErrorId = "规则检查失败:" + ex.Message,
ErrorTip = "路面范围图层需与相应地类图斑地类编码保持一致",
ErrorType = "一类错误",
RuleCode = "LMFW102",
RuleName = "路面范围图层地类编码逻辑性检查",
RuleContent = "若DTBLMFWGX层地类编码与相应位置处的DTBDLTBGX层地类编码不一致,认定为错误图斑"
};
rst.Add(ruleEntity);
}
return rst;
}
/// <summary>
/// 城镇村范围内地类图斑城镇村标注检查
/// </summary>
/// <returns></returns>
public List<RuleEntity> CZC101()
{
List<RuleEntity> rst = new List<RuleEntity>();
try
{
string sql = $"select BSM from DTBDLTBGX where CZCSXM<>'' AND bsm NOT IN (SELECT BSM FROM DTBCZCDYDGX)";
DataTable dt = mdbHelper.ExecuteDataTable(sql);
if (dt == null || dt.Rows.Count <= 0) return null;
foreach (DataRow item in dt.Rows)
{
rst.Add(new RuleEntity()
{
CheckObject = "DTBCZCDYDGX",
ErrorId = $"{item["BSM"].ToString()}",
ErrorTip = "城镇村等用地图层应与标注城镇村属性码图斑范围相一致",
ErrorType = "一类错误",
RuleCode = "CZC101",
RuleName = "城镇村等用地范围上图检查",
RuleContent= "通过DTBDLTBGX层中,“城镇村属性码”不为空的图斑“标识码”字段,均需位于DTBCZCDYDGX表中的“标识码”字段中;否则,认定为错误图斑。"
});
}
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "DTBCZCDYDGX",
ErrorId = "规则检查失败:" + ex.Message,
ErrorTip = "城镇村等用地图层应与标注城镇村属性码图斑范围相一致",
ErrorType = "一类错误",
RuleCode = "CZC101",
RuleName = "城镇村等用地范围上图检查",
RuleContent = "通过DTBDLTBGX层中,“城镇村属性码”不为空的图斑“标识码”字段,均需位于DTBCZCDYDGX表中的“标识码”字段中;否则,认定为错误图斑。"
};
rst.Add(ruleEntity);
}
return rst;
}
public List<RuleEntity> CZC102()
{
List<RuleEntity> rst = new List<RuleEntity>();
try
{
string sql = $"SELECT BSM FROM DTBDLTBGX WHERE CZCSXM='' AND BSM IN (SELECT BSM FROM DTBCZCDYDGX)";
DataTable dt = mdbHelper.ExecuteDataTable(sql);
if (dt == null || dt.Rows.Count <= 0) return null;
foreach (DataRow item in dt.Rows)
{
rst.Add(new RuleEntity()
{
CheckObject = "DTBCZCDYDGX",
ErrorId = $"{item["BSM"].ToString()}",
ErrorTip = "未标注城镇村属性码的图斑不应位于城镇村等用地范围中",
ErrorType = "一类错误",
RuleCode = "CZC102",
RuleName = "城镇村范围外地类图斑城镇村标注检查",
RuleContent = "通过DLTDLTBGX层中“城镇村属性码”为空的图斑,依据其“标识码”,查看其“标识码”是否位于DTBCZCDYDGX表中的“标识码”字段中,若存在,认定为错误图斑。"
});
}
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "DTBCZCDYDGX",
ErrorId = "规则检查失败:" + ex.Message,
ErrorTip = "未标注城镇村属性码的图斑不应位于城镇村等用地范围中",
ErrorType = "一类错误",
RuleCode = "CZC102",
RuleName = "城镇村范围外地类图斑城镇村标注检查",
RuleContent = "通过DLTDLTBGX层中“城镇村属性码”为空的图斑,依据其“标识码”,查看其“标识码”是否位于DTBCZCDYDGX表中的“标识码”字段中,若存在,认定为错误图斑。"
};
rst.Add(ruleEntity);
}
return rst;
}
public List<RuleEntity> CZC103()
{
List<RuleEntity> rst = new List<RuleEntity>();
try
{
string sql = $"SELECT A.BSM FROM DTBCZCDYDGX A LEFT JOIN DTBDLTBGX B ON A.BSM=B.BSM WHERE A.CZCLX<>B.CZCSXM or A.CZCDM<>B.CZCSXM ";
DataTable dt = mdbHelper.ExecuteDataTable(sql);
if (dt == null || dt.Rows.Count <= 0) return null;
foreach (DataRow item in dt.Rows)
{
rst.Add(new RuleEntity()
{
CheckObject = "DTBCZCDYDGX",
ErrorId = $"{item["BSM"].ToString()}",
ErrorTip = "标注城镇村属性码的地类图斑,其城镇村属性码必须与城镇村等用地层城镇村等用地类型保持一致。",
ErrorType = "一类错误",
RuleCode = "CZC103",
RuleName = "城镇村等用地层城镇村标注逻辑性检查",
RuleContent = "若DTBCZCDYDGX层中的“标识码”字段找到相应DTBDLTBGX层中的图斑,查看DTBCZCDYDGX层中“城镇村类型”“城镇村代码”字段是否与DTBDLTBGX层中“城镇村属性码”相一致,若不相同,认定为错误图斑。"
});
}
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "DTBCZCDYDGX",
ErrorId = "规则检查失败:" + ex.Message,
ErrorTip = "标注城镇村属性码的地类图斑,其城镇村属性码必须与城镇村等用地层城镇村等用地类型保持一致。",
ErrorType = "一类错误",
RuleCode = "CZC103",
RuleName = "城镇村等用地层城镇村标注逻辑性检查",
RuleContent = "若DTBCZCDYDGX层中的“标识码”字段找到相应DTBDLTBGX层中的图斑,查看DTBCZCDYDGX层中“城镇村类型”“城镇村代码”字段是否与DTBDLTBGX层中“城镇村属性码”相一致,若不相同,认定为错误图斑。"
};
rst.Add(ruleEntity);
}
return rst;
}
public List<RuleEntity> GD103()
{
List<RuleEntity> rst = new List<RuleEntity>();
try
{
string sql = "SELECT A.* FROM DTBDLTBGX A LEFT JOIN DTBDLTBGXGC B ON A.BSM=B.BGHTBBSM WHERE A.DLBM LIKE '%K' AND B.BGQDLBM<>B.BGHDLBM";
DataTable dt = mdbHelper.ExecuteDataTable(sql);
if (dt == null || dt.Rows.Count <= 0)
return null;
foreach (DataRow item in dt.Rows)
{
rst.Add(new RuleEntity()
{
CheckObject = "DTBDLTBGX",
ErrorId = $"{item["BSM"].ToString()}",
ErrorTip = "不得新增可调整地类图斑",
ErrorType = "一类错误",
RuleCode = "GD103",
RuleName = "新增可调整地类检查"
});
}
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "DTBDLTBGX",
ErrorId = "规则检查失败:" + ex.Message,
ErrorTip = "不得新增可调整地类图斑",
ErrorType = "一类错误",
RuleCode = "GD103",
RuleName = "新增可调整地类检查"
};
rst.Add(ruleEntity);
}
return rst;
}
public List<RuleEntity> HDGD001()
{
List<RuleEntity> rst = new List<RuleEntity>();
try
{
string sql = "SELECT * FROM DTBDLTBGX WHERE TBXHDM='HDGD' AND ZZSXDM='WG'";
DataTable dt = mdbHelper.ExecuteDataTable(sql);
if (dt == null || dt.Rows.Count <= 0)
return null;
foreach (DataRow item in dt.Rows)
{
rst.Add(new RuleEntity()
{
CheckObject = "DTBDLTBGX",
ErrorId = $"{item["BSM"].ToString()}",
ErrorTip = "河道耕地不得标注未耕种",
ErrorType = "一类错误",
RuleCode = "HDGD001",
RuleName = "河道耕地种植属性标注检查",
RuleContent = "检查单图斑地类图斑更新层中图斑细化代码为HDGD的图斑;若种植属性代码为WG,认定为错误图斑"
});
}
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "DTBDLTBGX",
ErrorId = "规则检查失败:" + ex.Message,
ErrorTip = "河道耕地不得标注未耕种",
ErrorType = "一类错误",
RuleCode = "HDGD001",
RuleName = "河道耕地种植属性标注检查",
RuleContent = "检查单图斑地类图斑更新层中图斑细化代码为HDGD的图斑;若种植属性代码为WG,认定为错误图斑"
};
rst.Add(ruleEntity);
}
return rst;
}
public List<RuleEntity> TTQ001()
{
List<RuleEntity> rst = new List<RuleEntity>();
try
{
string sql = $"SELECT * FROM DTBDLTBGX WHERE DDTCBZ='1303' AND DLBM IN ({DLParams.gd_dlbms}) AND ZZSXDM<>'WG'";
DataTable dt = mdbHelper.ExecuteDataTable(sql);
if (dt == null || dt.Rows.Count <= 0)
return null;
foreach (DataRow item in dt.Rows)
{
rst.Add(new RuleEntity()
{
CheckObject = "DTBDLTBGX",
ErrorId = $"{item["BSM"].ToString()}",
ErrorTip = "推土区范围内的耕地种植属性应为“WG”",
ErrorType = "一类错误",
RuleCode = "TTQ001",
RuleName = "推土区下耕地种植属性标注检查",
RuleContent = "检查DTBDLTBGX层中标注“推土区”、且地类编码为“01类”的图斑,其种植属性代码是否为WG;若不为WG,认定为错误图斑"
});
}
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "DTBDLTBGX",
ErrorId = "规则检查失败:" + ex.Message,
ErrorTip = "推土区范围内的耕地种植属性应为“WG”",
ErrorType = "一类错误",
RuleCode = "TTQ001",
RuleName = "推土区下耕地种植属性标注检查",
RuleContent = "检查DTBDLTBGX层中标注“推土区”、且地类编码为“01类”的图斑,其种植属性代码是否为WG;若不为WG,认定为错误图斑"
};
rst.Add(ruleEntity);
}
return rst;
}
public List<RuleEntity> LNGD001()
{
List<RuleEntity> result = new List<RuleEntity>();
if (!FirstRun)
return result;
try
{
CheckHelper.MDBHelper tMdbHelper = new CheckHelper.MDBHelper(ProcessDataPath);
tMdbHelper.connOpen();
System.Data.DataTable dataTable = tMdbHelper.ExecuteDataTable($"select a.bsm from (SELECT bsm,sum(shape_area) as MJ from LNGD_R where dlbm='0404' and zzsxdm='' and ddtcbz='' and xpdjb='f5' and xgdlx in ('','PD') AND DLBM_1 IN ('0101','0102','0103','0201','0201K','0202','0202K','0203','0203K','0204','0204K','0301','0301K','0302','0302K','0303','0304','0305','0306','0307','0307K','0401','0402','0403','0403K','1006','1103','1104','1104A','1104K','1107','1107A','1202','1203') group by bsm) a left join DTBDLTBGX b on a.bsm=b.bsm where a.mj/b.shape_area>0.9");
if (dataTable != null && dataTable.Rows.Count > 0)
{
foreach (DataRow item in dataTable.Rows)
{
result.Add(new RuleEntity()
{
CheckObject = "DTBDLTBGX层",
ErrorId = item[0].ToString(),
ErrorTip = "实地为荒草地图斑与存量耕地重叠比例大于90%,整图斑应按耕地未耕种上图。",
ErrorType = "一类错误",
RuleCode = "LNGD001",
RuleName = "荒草地上图检查",
RuleContent = "实地为荒草地图斑与存量耕地重叠比例大于90%,整图斑应按耕地未耕种上图。"
});
}
}
tMdbHelper.DisConn();
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "DTBDLTBGX层",
ErrorId = "规则检查失败:" + ex.Message,
ErrorTip = "实地为荒草地图斑与存量耕地重叠比例大于90%,整图斑应按耕地未耕种上图。",
ErrorType = "一类错误",
RuleCode = "LNGD001",
RuleName = "荒草地上图检查",
RuleContent = "实地为荒草地图斑与存量耕地重叠比例大于90%,整图斑应按耕地未耕种上图。"
};
result.Add(ruleEntity);
}
return result;
}
public List<RuleEntity> LNGD002()
{
List<RuleEntity> result = new List<RuleEntity>();
if (!FirstRun)
return result;
try
{
CheckHelper.MDBHelper tMdbHelper = new CheckHelper.MDBHelper(ProcessDataPath);
tMdbHelper.connOpen();
System.Data.DataTable dataTable = tMdbHelper.ExecuteDataTable($"select a.bsm from (SELECT bsm,sum(shape_area) as MJ from LNGD_R where dlbm='0404' and zzsxdm='' and ddtcbz='' and xpdjb='f5' and xgdlx in ('','PD') AND DLBM_1 IN ('0101','0102','0103','0201','0201K','0202','0202K','0203','0203K','0204','0204K','0301','0301K','0302','0302K','0303','0304','0305','0306','0307','0307K','0401','0402','0403','0403K','1006','1103','1104','1104A','1104K','1107','1107A','1202','1203') group by bsm) a where a.mj>200");
if (dataTable != null && dataTable.Rows.Count > 0)
{
foreach (DataRow item in dataTable.Rows)
{
result.Add(new RuleEntity()
{
CheckObject = "DTBDLTBGX层",
ErrorId = item[0].ToString(),
ErrorTip = "实地为荒草地图斑与存量耕地重叠大于200平,重叠部分核实是否应按耕地未耕种上图",
ErrorType = "一类错误",
RuleCode = "LNGD002",
RuleName = "荒草地上图检查",
RuleContent = "实地为荒草地图斑与存量耕地重叠大于200平,重叠部分核实是否应按耕地未耕种上图"
});
}
}
tMdbHelper.DisConn();
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "DTBDLTBGX层",
ErrorId = "规则检查失败:" + ex.Message,
ErrorTip = "实地为荒草地图斑与存量耕地重叠大于200平,重叠部分核实是否应按耕地未耕种上图",
ErrorType = "一类错误",
RuleCode = "LNGD002",
RuleName = "荒草地上图检查",
RuleContent = "实地为荒草地图斑与存量耕地重叠大于200平,重叠部分核实是否应按耕地未耕种上图"
};
result.Add(ruleEntity);
}
return result;
}
public List<RuleEntity> LNGD003()
{
List<RuleEntity> result = new List<RuleEntity>();
if (!FirstRun)
return result;
try
{
CheckHelper.MDBHelper tMdbHelper = new CheckHelper.MDBHelper(ProcessDataPath);
tMdbHelper.connOpen();
System.Data.DataTable dataTable = tMdbHelper.ExecuteDataTable($"select a.bsm from (SELECT bsm,sum(shape_area) as MJ from LNGD_R where dlbm IN ('0101','0102','0103') and zzsxdm='WG' and ddtcbz='' and xpdjb='f5' and xgdlx in ('','PD') AND DLBM_1 IN ('0101','0102','0103','0201','0201K','0202','0202K','0203','0203K','0204','0204K','0301','0301K','0302','0302K','0303','0304','0305','0306','0307','0307K','0401','0402','0403','0403K','1006','1103','1104','1104A','1104K','1107','1107A','1202','1203') group by bsm) a left join DTBDLTBGX b on a.bsm=b.bsm where a.mj/b.shape_area<=0.1");
if (dataTable != null && dataTable.Rows.Count > 0)
{
foreach (DataRow item in dataTable.Rows)
{
result.Add(new RuleEntity()
{
CheckObject = "DTBDLTBGX层",
ErrorId = item[0].ToString(),
ErrorTip = "实地为荒草地图斑与存量耕地不重叠比例大于90%,整图斑应按荒草地上图。",
ErrorType = "一类错误",
RuleCode = "LNGD003",
RuleName = "耕地未耕种上图检查",
RuleContent = "实地为荒草地图斑与存量耕地不重叠比例大于90%,整图斑应按荒草地上图。"
});
}
}
tMdbHelper.DisConn();
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "DTBDLTBGX层",
ErrorId = "规则检查失败:" + ex.Message,
ErrorTip = "实地为荒草地图斑与存量耕地不重叠比例大于90%,整图斑应按荒草地上图。",
ErrorType = "一类错误",
RuleCode = "LNGD003",
RuleName = "耕地未耕种上图检查",
RuleContent = "实地为荒草地图斑与存量耕地不重叠比例大于90%,整图斑应按荒草地上图。。"
};
result.Add(ruleEntity);
}
return result;
}
public List<RuleEntity> LNGD004()
{
List<RuleEntity> result = new List<RuleEntity>();
if (!FirstRun)
return result;
try
{
CheckHelper.MDBHelper tMdbHelper = new CheckHelper.MDBHelper(ProcessDataPath);
tMdbHelper.connOpen();
System.Data.DataTable dataTable = tMdbHelper.ExecuteDataTable($"select a.bsm from (SELECT bsm,sum(shape_area) as MJ from LNGD_R where dlbm IN ('0101','0102','0103') and zzsxdm='WG' and ddtcbz='' and xpdjb='f5' and xgdlx in ('','PD') AND DLBM_1 IN ('0101','0102','0103','0201','0201K','0202','0202K','0203','0203K','0204','0204K','0301','0301K','0302','0302K','0303','0304','0305','0306','0307','0307K','0401','0402','0403','0403K','1006','1103','1104','1104A','1104K','1107','1107A','1202','1203') group by bsm) a left join DTBDLTBGX b on a.bsm=b.bsm where b.shape_area-A.MJ>400");
if (dataTable != null && dataTable.Rows.Count > 0)
{
foreach (DataRow item in dataTable.Rows)
{
result.Add(new RuleEntity()
{
CheckObject = "DTBDLTBGX层",
ErrorId = item[0].ToString(),
ErrorTip = "实地为荒草地图斑与存量耕地不重叠面积大于400平,核实不重叠部分是否应按荒草地上图。",
ErrorType = "一类错误",
RuleCode = "LNGD004",
RuleName = "耕地未耕种上图检查",
RuleContent = "实地为荒草地图斑与存量耕地不重叠面积大于400平,核实不重叠部分是否应按荒草地上图。"
});
}
}
tMdbHelper.DisConn();
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "DTBDLTBGX层",
ErrorId = "规则检查失败:" + ex.Message,
ErrorTip = "实地为荒草地图斑与存量耕地不重叠面积大于400平,核实不重叠部分是否应按荒草地上图。",
ErrorType = "一类错误",
RuleCode = "LNGD004",
RuleName = "耕地未耕种上图检查",
RuleContent = "实地为荒草地图斑与存量耕地不重叠面积大于400平,核实不重叠部分是否应按荒草地上图。"
};
result.Add(ruleEntity);
}
return result;
}
public List<RuleEntity> HFSX001()
{
List<RuleEntity> result = new List<RuleEntity>();
if (!FirstRun)
return result;
try
{
CheckHelper.MDBHelper tMdbHelper = new CheckHelper.MDBHelper(ProcessDataPath);
tMdbHelper.connOpen();
System.Data.DataTable dataTable = tMdbHelper.ExecuteDataTable($"select b.bsm,b.IMJ/c.MJ from (select bsm,sum(shape_area) as IMJ from (select bsm,dlbm,zzsxdm,shape_area from HFSX_R where (ZZSXDM_1 in ('JKHF','GCHF') AND PDJB<>'5') OR (DLBM_1 in ('0101','0102','0103') and GDLX_1 not in ('PD') and GDPDJB_1<>'5'))a where a.zzsxdm='JKHF' and DLBM IN ('0201','0202','0203','0204','0301','0302','0305','0307','0404','1104','1104A') group by bsm) b left join (select bsm,sum(shape_area) as MJ from HFSX_R where DLBM IN ('0201','0202','0203','0204','0301','0302','0305','0307','0404','1104','1104A') AND zzsxdm ='JKHF' group by bsm)c on b.bsm =c.bsm where b.IMJ/c.MJ<0.8");
if (dataTable != null && dataTable.Rows.Count > 0)
{
foreach (DataRow item in dataTable.Rows)
{
result.Add(new RuleEntity()
{
CheckObject = "DTBDLTBGX层",
ErrorId = item[0].ToString(),
ErrorTip = "JKHF图斑与参考图层重叠部分不够比例。",
ErrorType = "一类错误",
RuleCode = "HFSX001",
RuleName = "即可恢复图斑上图检查",
RuleContent = "JKHF图斑与参考图层重叠部分不够比例。"
});
}
}
tMdbHelper.DisConn();
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "DTBDLTBGX层",
ErrorId = "规则检查失败:" + ex.Message,
ErrorTip = "JKHF图斑与参考图层重叠部分不够比例。",
ErrorType = "一类错误",
RuleCode = "HFSX001",
RuleName = "即可恢复图斑上图检查",
RuleContent = "JKHF图斑与参考图层重叠部分不够比例。"
};
result.Add(ruleEntity);
}
return result;
}
public List<RuleEntity> HFSX002()
{
List<RuleEntity> result = new List<RuleEntity>();
if (!FirstRun)
return result;
try
{
CheckHelper.MDBHelper tMdbHelper = new CheckHelper.MDBHelper(ProcessDataPath);
tMdbHelper.connOpen();
System.Data.DataTable dataTable = tMdbHelper.ExecuteDataTable($"select b.bsm,b.IMJ/c.MJ from (select bsm,sum(shape_area) as IMJ from (select bsm,dlbm,zzsxdm,shape_area from HFSX_R where (ZZSXDM_1 in ('JKHF','GCHF') AND PDJB<>'5') OR (DLBM_1 in ('0101','0102','0103') and GDLX_1 not in ('PD') and GDPDJB_1<>'5'))a where a.zzsxdm='GCHF' and DLBM IN ('0201','0202','0203','0204','0301','0302','0305','0307','0404','1104','1104A') group by bsm) b left join (select bsm,sum(shape_area) as MJ from HFSX_R where DLBM IN ('0201','0202','0203','0204','0301','0302','0305','0307','0404','1104','1104A') AND zzsxdm ='GCHF' group by bsm)c on b.bsm =c.bsm where b.IMJ/c.MJ<0.5");
if (dataTable != null && dataTable.Rows.Count > 0)
{
foreach (DataRow item in dataTable.Rows)
{
result.Add(new RuleEntity()
{
CheckObject = "DTBDLTBGX层",
ErrorId = item[0].ToString(),
ErrorTip = "GCHF图斑与参考图层重叠部分不够比例。",
ErrorType = "一类错误",
RuleCode = "HFSX002",
RuleName = "工程恢复图斑上图检查",
RuleContent = "GCHF图斑与参考图层重叠部分不够比例。"
});
}
}
tMdbHelper.DisConn();
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "DTBDLTBGX层",
ErrorId = "规则检查失败:" + ex.Message,
ErrorTip = "GCHF图斑与参考图层重叠部分不够比例。",
ErrorType = "一类错误",
RuleCode = "HFSX002",
RuleName = "工程恢复图斑上图检查",
RuleContent = "GCHF图斑与参考图层重叠部分不够比例。"
};
result.Add(ruleEntity);
}
return result;
}
public List<RuleEntity> HFSX003()
{
List<RuleEntity> result = new List<RuleEntity>();
if (!FirstRun)
return result;
try
{
CheckHelper.MDBHelper tMdbHelper = new CheckHelper.MDBHelper(ProcessDataPath);
tMdbHelper.connOpen();
System.Data.DataTable dataTable = tMdbHelper.ExecuteDataTable($"select b.bsm,b.IMJ/c.MJ from (select bsm,sum(shape_area) as IMJ from (select bsm,dlbm,zzsxdm,shape_area from HFSX_R where (ZZSXDM_1 in ('JKHF','GCHF') AND PDJB<>'5') OR (DLBM_1 in ('0101','0102','0103') and GDLX_1 not in ('PD') and GDPDJB_1<>'5'))a where a.zzsxdm='' and DLBM IN ('0201','0202','0203','0204','0301','0302','0305','0307','0404','1104','1104A') group by bsm) b left join (select bsm,sum(shape_area) as MJ from HFSX_R where DLBM IN ('0201','0202','0203','0204','0301','0302','0305','0307','0404','1104','1104A') AND zzsxdm ='' group by bsm)c on b.bsm =c.bsm where b.IMJ/c.MJ>0.5");
if (dataTable != null && dataTable.Rows.Count > 0)
{
foreach (DataRow item in dataTable.Rows)
{
result.Add(new RuleEntity()
{
CheckObject = "DTBDLTBGX层",
ErrorId = item[0].ToString(),
ErrorTip = "应标注恢复属性",
ErrorType = "一类错误",
RuleCode = "HFSX003",
RuleName = "未标注恢复属性图斑上图检查",
RuleContent = "应标注恢复属性"
});
}
}
tMdbHelper.DisConn();
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "DTBDLTBGX层",
ErrorId = "规则检查失败:" + ex.Message,
ErrorTip = "应标注恢复属性",
ErrorType = "一类错误",
RuleCode = "HFSX003",
RuleName = "未标注恢复属性图斑上图检查",
RuleContent = "应标注恢复属性"
};
result.Add(ruleEntity);
}
return result;
}
}
}