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

1924 lines
110 KiB

6 months ago
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ESRI.ArcGIS.Geodatabase;
using ESRI.ArcGIS.Geometry;
using Kingo.RuleCheck.CheckHelper;
namespace Kingo.RuleCheck.XJRuleCheck
{
/// <summary>
/// 地类属性与举证照片逻辑性检查
/// </summary>
public class DLSXYJZZPCheck_DTB : RuleCheckBase_DTB
{
public DLSXYJZZPCheck_DTB()
{
var list = GetConfigList("DLSXYJZZPCheck_DTB");
if (list.Count > 0)
ruleMethodNames = list;
}
private List<string> ruleMethodNames = new List<string>()
{
//"JZ001","JZ002","JZ003","JZ004","JZ005","JZ007","JZ008","JZ009","JZ010","JZ011","JZ012","JZ013","WYZP011","BCSM001","BCSM002","JZ014","JZ041","SM201","JZ020","JZ015","WYZP004","JZ016","JZ017","JZ018","JZ019","JZ022","JZ023","JZ024","JZ025","JZ026","JZ027","JZ028","JZ029","JZ030"
};
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, IFeatureClass> workspace)
{
return this.StartCheck(sourePath, workspace, ruleMethodNames);
}
public override List<RuleEntity> ExcuteCheck(string tbbsm, string sourePath, Dictionary<string, IFeatureClass> workspace)
{
return this.StartCheck(tbbsm, sourePath, workspace, ruleMethodNames);
}
public List<RuleEntity> JZ001()
{
List<RuleEntity> result = new List<RuleEntity>();
try
{
//2021/8/4修改当图斑无附件时,无法检测出来问题。SELECT * FROM (SELECT TBBSM,COUNT(1) AS GS FROM FJGX WHERE TBBSM IN (SELECT BSM FROM DTBDLTBGX WHERE DLBM IN ('0101','0102','0103')) GROUP BY TBBSM) WHERE GS<3
System.Data.DataTable dataTable = SQLiteDBOperate.Instance.ExceDataTable(this.SourcePath, $"select bsm from DTBDLTBGX where TBBSM='{this.TBBSM}'and dlbm not like '99%' and substr(TBBSM,7,4)<>'WYHC' and DLBM IN ('0101','0102','0103') and bsm not in (select tbbsm FROM FJGX group by tbbsm having count(tbbsm) >0) and ljlx <> '按规程无需举证'");
if (dataTable != null && dataTable.Rows.Count > 0)
{
foreach (DataRow item in dataTable.Rows)
{
result.Add(new RuleEntity()
{
CheckObject = "DTBDLTBGX",
ErrorId = item[0].ToString(),
BGFWBSM = item[0].ToString(),
ErrorTip = "耕地类图斑必须进行外业实地举证",
ErrorType = "一类错误",
RuleCode = "JZ001",
RuleName = "耕地类图斑与举证照片逻辑性检查",
RuleContent = "对于“地类编码”字段值域为“01类”的图斑,若不存在实地举证照片,认定为错误图斑。"
});
}
}
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "DTBDLTBGX",
ErrorId = this.TBBSM,
ErrorTip = "耕地类图斑必须进行外业实地举证规则检查失败:" + ex.Message,
ErrorType = "一类错误",
RuleCode = "JZ001",
RuleName = "耕地类图斑与举证照片逻辑性检查",
RuleContent = "对于“地类编码”字段值域为“01类”的图斑,若不存在实地举证照片,认定为错误图斑。"
};
result.Add(ruleEntity);
}
return result;
}
//public List<RuleEntity> JZ002()
//{
// List<RuleEntity> result = new List<RuleEntity>();
// try
// {
// DataTable dataTable = SQLiteDBOperate.Instance.ExceDataTable(this.SourcePath, $"SELECT distinct A.BSM FROM DTBDLTBGX A LEFT JOIN FJGX B ON A.BSM=B.TBBSM WHERE A.TBBSM='{TBBSM}' and substr(A.TBBSM,7,4)<>'WYHC' AND A.DDTCBZ IN ('1301','1302','1303','1304') AND (B.TBBSM IS NULL OR B.TBBSM ='' or (A.LJLX IS NOT NULL and A.LJLX not in ('','农变未','水旱轮作')))");
// if (dataTable != null && dataTable.Rows.Count > 0)
// {
// foreach (DataRow item in dataTable.Rows)
// {
// result.Add(new RuleEntity()
// {
// CheckObject = "DTBDLTBGX",
// ErrorId = item[0].ToString(),
// BGFWBSM = item[0].ToString(),
// ErrorTip = "临时用地、光伏板区、推土区、拆除未尽区图斑必须进行外业实地举证,且不得标记类举类型",
// ErrorType = "一类错误",
// RuleCode = "JZ002",
// RuleName = "独立图层图斑与举证照片逻辑性检查",
// RuleContent = "对于“独立图层代码”字段值域为“1301”、“1302”、“1303”或“1304”的图斑,若“类举类型”字段不为“农变未”,“水旱轮作”,“空”,认定为错误图斑。若不存在实地举证照片,认定为错误图斑"
// });
// }
// }
// }
// catch (Exception ex)
// {
// RuleEntity ruleEntity = new RuleEntity()
// {
// CheckObject = "DTBDLTBGX",
// ErrorId = this.TBBSM,
// ErrorTip = "临时用地、光伏板区、推土区、拆除未尽区图斑必须进行外业实地举证,且不得标记类举类型规则检查失败:" + ex.Message,
// ErrorType = "一类错误",
// RuleCode = "JZ002",
// RuleName = "独立图层图斑与举证照片逻辑性检查",
// RuleContent = "对于“独立图层代码”字段值域为“1301”、“1302”、“1303”或“1304”的图斑,若“类举类型”字段不为“空”,认定为错误图斑。若不存在实地举证照片,认定为错误图斑"
// };
// result.Add(ruleEntity);
// }
// return result;
//}
public List<RuleEntity> JZ003()
{
List<RuleEntity> result = new List<RuleEntity>();
//return result;
try
{
string sql = $"select DISTINCT(d.BSM) from DTBDLTBGX d where DLBM='1202' AND D.TBBSM='{TBBSM}'AND D.dlbm not like '99%' AND bsm not in (select tbbsm FROM FJGX group by tbbsm having count(tbbsm) >0) ";
DataTable dataTable = SQLiteDBOperate.Instance.ExceDataTable(this.SourcePath, sql);
if (dataTable != null && dataTable.Rows.Count > 0)
{
foreach (DataRow item in dataTable.Rows)
{
result.Add(new RuleEntity()
{
CheckObject = "DTBDLTBGX",
ErrorId = item[0].ToString(),
BGFWBSM = item[0].ToString(),
ErrorTip = "设施农用地图斑必须存在实地举证照片",
ErrorType = "一类错误",
RuleCode = "JZ003",
RuleName = "设施农用地图斑与举证照片逻辑性检查",
RuleContent = "对于“地类编码”字段值域为“1202”的图斑,若不存在实地举证照片照片,认定为错误图斑"
});
}
}
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "DTBDLTBGX",
ErrorId = this.TBBSM,
ErrorTip = "设施农用地图斑必须存在实地举证照片" + ex.Message,
ErrorType = "一类错误",
RuleCode = "JZ003",
RuleName = "设施农用地图斑与举证照片逻辑性检查",
RuleContent = "对于“地类编码”字段值域为“1202”的图斑,若不存在实地举证照片照片,认定为错误图斑"
};
result.Add(ruleEntity);
}
//try
//{
// DataTable dataTable = this.mdbHelper.ExecuteDataTable($"SELECT * FROM (SELECT TBBSM,COUNT(1) AS GS FROM FJGX WHERE TBBSM IN (SELECT BSM FROM DTBDLTBGX WHERE DLBM='1202') GROUP BY TBBSM) WHERE GS<3 ");
// 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 = "JZ003",
// RuleName = "设施农用地图斑与举证照片逻辑性检查",
// RuleContent = "对于“地类编码”字段值域为“1202”的图斑,若不存在特征照片,认定为错误图斑"
// });
// }
// }
//}
//catch (Exception ex)
//{
// RuleEntity ruleEntity = new RuleEntity()
// {
// CheckObject = "DTBDLTBGX",
// ErrorId = "规则检查失败:" + ex.Message,
// ErrorTip = "设施农用地图斑必须存在特征照片",
// ErrorType = "一类错误",
// RuleCode = "JZ003",
// RuleName = "设施农用地图斑与举证照片逻辑性检查",
// RuleContent = "对于“地类编码”字段值域为“1202”的图斑,若不存在特征照片,认定为错误图斑"
// };
// result.Add(ruleEntity);
//}
return result;
}
public List<RuleEntity> JZ004()
{
List<RuleEntity> result = new List<RuleEntity>();
try
{
//2021/8/4修改 $"SELECT C.BSM FROM (SELECT A.BSM,B.TBBGMJ,B.BGQTBDLMJ,A.LJLX FROM DTBDLTBGX A LEFT JOIN DTBDLTBGXGC B ON A.BSM=B.BGHTBBSM WHERE B.BGQDLBM IN ({DLParams.nyd_dlbms}) AND B.BGHDLBM NOT IN ({DLParams.wlyd_dlbms})) C LEFT JOIN FJGX D ON C.BSM=D.TBBSM WHERE ((TBBGMJ>400 OR TBBGMJ/BGQTBDLMJ>0.3) AND (LJLX IS NOT NULL OR LJLX<>'')) OR D.TBBSM IS NULL OR D.TBBSM='' "
var sql = $"select BGHTBBSM from DTBDLTBGXGC where TBBSM='{TBBSM}' and substr(TBBSM,7,4)<>'WYHC' AND BGQDLBM 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') and bghdlbm in ('0404','0404A','1101','1102','1105','1106','1108','1204','1205','1206','1207') and (TBBGMJ>400 or TBBGMJ/BGQTBDLMJ>0.3) and (BGHTBBSM not in(select tbbsm FROM FJGX group by tbbsm having count(tbbsm) >0) or BGHTBBSM not in (select bsm FROM DTBDLTBGX where ljlx='农变未' and dlbm not like '99%'))";
DataTable dataTable = SQLiteDBOperate.Instance.ExceDataTable(this.SourcePath, sql);
if (dataTable != null && dataTable.Rows.Count > 0)
{
foreach (DataRow item in dataTable.Rows)
{
result.Add(new RuleEntity()
{
CheckObject = "DTBDLTBGX",
ErrorId = item[0].ToString(),
BGFWBSM = item[0].ToString(),
ErrorTip = "农用地变未利用地图斑必须标注“农变未”且存在实地举证照片",
ErrorType = "一类错误",
RuleCode = "JZ004",
RuleName = "农用地变未利用地图斑与举证照片逻辑性检查",
RuleContent = "对于DTBDLTBGXGC层中,变更前地类为农用地(地类编码属于01-03、0401-0403、1006、1103-1104、1107、1202-1203的)、变更后地类编码为0404、0404A、1101、1102、1105、1106、1108、1204、1205、1206、1207的,当面积大于等于400平方米,或占原图斑面积超过30%时,若相应DTBDLTBGX层图斑“类举类型”字段不为“农变未”,认定为错误图斑。若相应DTBDLTBGX层图斑不存在实地举证照片,认定为错误图斑。"
});
}
}
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "DTBDLTBGX",
ErrorId = this.TBBSM,
ErrorTip = "农用地变未利用地图斑必须标注“农变未”且存在实地举证照片规则检查失败:" + ex.Message,
ErrorType = "一类错误",
RuleCode = "JZ004",
RuleName = "农用地变未利用地图斑与举证照片逻辑性检查",
RuleContent = "对于DTBDLTBGXGC层中,变更前地类为农用地(地类编码属于01-03、0401-0403、1006、1103-1104、1107、1202-1203的)、变更后地类编码为0404、0404A、1108、1204、1205、1206、1207的,当面积大于等于400平方米,或占原图斑面积超过30%时,若相应DTBDLTBGX层图斑“类举类型”字段不为“农变未”,认定为错误图斑。若相应DTBDLTBGX层图斑不存在实地举证照片,认定为错误图斑。"
};
result.Add(ruleEntity);
}
return result;
}
public List<RuleEntity> JZ005()
{
List<RuleEntity> result = new List<RuleEntity>();
try
{
var sql = $"SELECT BSM FROM DTBDLTBGX WHERE TBBSM='{TBBSM}' and dlbm not like '99%' and ((LJLX is not null and LJLX<>'' and (tbybh is null or tbybh='')) or (bsm in (select tbbsm FROM FJGX group by tbbsm having count(tbbsm) >0)) and (tbybh is null or tbybh='') or (tbybh is not null and tbybh<>'' and ((LJLX is null or LJLX='') and bsm not in (select tbbsm FROM FJGX group by tbbsm having count(tbbsm) >0))))";
DataTable dataTable = SQLiteDBOperate.Instance.ExceDataTable(this.SourcePath, sql);
if (dataTable != null && dataTable.Rows.Count > 0)
{
foreach (DataRow item in dataTable.Rows)
{
result.Add(new RuleEntity()
{
CheckObject = "DTBDLTBGX",
ErrorId = item[0].ToString(),
BGFWBSM = item[0].ToString(),
ErrorTip = "采用实地举证或标记“类举类型”的图斑,图斑预编号不可为空",
ErrorType = "一类错误",
RuleCode = "JZ005",
RuleName = "图斑预编号逻辑性检查",
RuleContent = "(1)若“类举类型”字段不为“空”,且图斑预编号为“空”的,判定为错误图斑。若图斑存在实地举证照片,且图斑预编号为“空”,判定为错误图斑。(2)当“图斑预编号”不为空时,“类举类型”字段为空且图斑不存在实地举证照片,认定为错误图斑"
});
}
}
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "DTBDLTBGX",
ErrorId = this.TBBSM,
ErrorTip = "采用实地举证或标记“类举类型”的图斑,图斑预编号不可为空规则检查失败:" + ex.Message,
ErrorType = "一类错误",
RuleCode = "JZ005",
RuleName = "图斑预编号逻辑性检查",
RuleContent = "(1)若“类举类型”字段不为“空”,且图斑预编号为“空”的,判定为错误图斑。若图斑存在实地举证照片,且图斑预编号为“空”,判定为错误图斑。(2)当“图斑预编号”不为空时,“类举类型”字段为空且图斑不存在实地举证照片,认定为错误图斑"
};
result.Add(ruleEntity);
}
return result;
}
//public List<RuleEntity> JZ006()
//{
// List<RuleEntity> result = new List<RuleEntity>();
// try
// {
// DataTable dataTable = this.mdbHelper.ExecuteDataTable($"SELECT A.BSM FROM DTBDLTBGX A LEFT JOIN FJGX B ON A.BSM=B.TBBSM WHERE A.LJLX IS NOT NULL AND A.LJLX<>'' AND B.TBBSM IS NOT NULL AND B.TBBSM<>'' GROUP BY A.BSM ");
// 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 = "JZ006",
// RuleName = "图斑预编号与类举类型逻辑性检查",
// RuleContent = "图斑存在实地举证照片时,若“类举类型”字段不为“空”,认定为错误图斑。"
// });
// }
// }
// }
// catch (Exception ex)
// {
// RuleEntity ruleEntity = new RuleEntity()
// {
// CheckObject = "DTBDLTBGX",
// ErrorId = "规则检查失败:" + ex.Message,
// ErrorTip = "采用实地举证的图斑,不可标注类举类型",
// ErrorType = "一类错误",
// RuleCode = "JZ006",
// RuleName = "图斑预编号与类举类型逻辑性检查",
// RuleContent = "图斑存在实地举证照片时,若“类举类型”字段不为“空”,认定为错误图斑。"
// };
// result.Add(ruleEntity);
// }
// return result;
//}
public List<RuleEntity> JZ007()
{
List<RuleEntity> result = new List<RuleEntity>();
return result;
try
{
DataTable dataTable = SQLiteDBOperate.Instance.ExceDataTable(this.SourcePath, $"SELECT BSM FROM DTBDLTBGX WHERE TBBSM='{TBBSM}' and dlbm not like '99%' AND (TBYBH IS NOT NULL AND TBYBH<>'' AND SFJZ='否') OR (TBYBH='' AND SFJZ='是')");
if (dataTable != null && dataTable.Rows.Count > 0)
{
foreach (DataRow item in dataTable.Rows)
{
result.Add(new RuleEntity()
{
CheckObject = "DTBDLTBGX",
ErrorId = item[0].ToString(),
BGFWBSM = item[0].ToString(),
ErrorTip = "实地举证或标记类举类型的图斑,“是否举证”字段需填“是”;否则,应填“否”",
ErrorType = "一类错误",
RuleCode = "JZ007",
RuleName = "图斑举证信息填写检查",
RuleContent = "若图斑“图斑预编号”字段不为空,“是否举证”字段值为“否”时,认定为错误图斑。当DLTB层图斑“图斑预编号”字段为空,“是否举证”字段值为“是”时,认定为错误图斑。"
});
}
}
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "DTBDLTBGX",
ErrorId = this.TBBSM,
ErrorTip = "实地举证或标记类举类型的图斑,“是否举证”字段需填“是”;否则,应填“否”规则检查失败:" + ex.Message,
ErrorType = "一类错误",
RuleCode = "JZ007",
RuleName = "图斑举证信息填写检查",
RuleContent = "若图斑“图斑预编号”字段不为空,“是否举证”字段值为“否”时,认定为错误图斑。当DLTB层图斑“图斑预编号”字段为空,“是否举证”字段值为“是”时,认定为错误图斑。"
};
result.Add(ruleEntity);
}
return result;
}
public List<RuleEntity> JZ008()
{
List<RuleEntity> result = new List<RuleEntity>();
IFeatureClass jc_dltbFeatureClass = null;
IGeometry dltbGXgeo = null;
IFeatureCursor pCursor = null;
IFeature feature = null;
try
{
DataTable dataTable = CheckHelper.SQLiteDBOperate.Instance.ExceDataTable(this.SourcePath, $"select * from dtbdltbgx where tbbsm='{TBBSM}' and dlbm not like '99%' and sfgx<>'整图斑变更' and dlbm<>'8801'");
if (dataTable == null || dataTable.Rows.Count <= 0)
return result;
if (!DicFeatureClass.ContainsKey("JC_DLTB") || DicFeatureClass["JC_DLTB"] == null)
{
throw new Exception("未找到“基础_地类图斑”参考图层!");
}
jc_dltbFeatureClass = DicFeatureClass["JC_DLTB"];
ISpatialFilter spatialFilter = new SpatialFilterClass
{
SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects
};
ISpatialReference spatialReference = (jc_dltbFeatureClass as IGeoDataset).SpatialReference;
//Console.WriteLine(spatialReference.Name);
if (spatialReference == null)
{
throw new Exception("基础_地类图斑数据坐标参考为空,质检失败!");
}
foreach (DataRow item in dataTable.Rows)
{
dltbGXgeo = CheckHelper.GeometryConvertHelper.ConverJsonToIGeoemtry(item["egeometry"].ToString(), esriGeometryType.esriGeometryPolygon);
dltbGXgeo.Project(spatialReference);
IArea geoArea = dltbGXgeo as IArea;
double area = geoArea.Area;
spatialFilter.Geometry = dltbGXgeo;
spatialFilter.WhereClause = $"DLBM<>'{item["dlbm"].ToString()}'";
pCursor = jc_dltbFeatureClass.Search(spatialFilter, true);
ITopologicalOperator topological = null;
while ((feature = pCursor.NextFeature()) != null)
{
if (topological == null)
{
topological = feature.ShapeCopy as ITopologicalOperator;
}
else
{
topological = topological.Union(feature.ShapeCopy) as ITopologicalOperator;
}
}
IGeometry GGeometry = null;
double GArea = 0;
IGeometry EGeometry = topological as IGeometry;
if (EGeometry != null && !EGeometry.IsEmpty)
{
topological = EGeometry as ITopologicalOperator;
if (EGeometry.SpatialReference == null)
{
EGeometry.SpatialReference = spatialReference;
}
GGeometry = CommonHelper.InterSect(dltbGXgeo, EGeometry);
GArea = (GGeometry as IArea).Area;
}
if (GArea / area > 0.9)
{
result.Add(new RuleEntity()
{
CheckObject = "DTBDLTBGX",
ErrorId = item["bsm"].ToString(),
BGFWBSM = item["bsm"].ToString(),
ErrorTip = "变化图斑“是否更新”字段应为“整图斑变更”。",
ErrorType = "一类错误",
RuleCode = "JZ008",
RuleName = "变化图斑变更信息填写检查",
RuleContent = "DTBDLTBGX层图斑相对于基础库变化部分的面积占DTBDLTBGX层图斑面积的比例在90%及以上时,若“是否更新”字段值不为“整图斑变更”,认定为错误图斑。"
});
}
}
// string sql = $@"SELECT A.BSM FROM DTBDLTBGX A LEFT JOIN (SELECT BGHTBBSM,SUM(TBBGMJ) AS MJ FROM DTBDLTBGXGC where TBBSM='{TBBSM}' and ((BGQDLBM=BGHDLBM and (BGHDLBM in ('0404A','1001A','1002A','1003A','1004A') and substr(BGHDLBM,0,4)=BGQDLBM)) and BGHTBXHDM=BGQTBXHDM and BGHZZSXDM=BGQZZSXDM) GROUP BY BGHTBBSM) B ON A.BSM=B.BGHTBBSM WHERE A.TBBSM='{TBBSM}' AND B.MJ/A.TBMJ<0.9 AND (SFGX<>DLBM or (DLBM in ('0404A','1001A','1002A','1003A','1004A') and substr(DLBM,0,4)<>SFGX))";
// //string sql = $@"SELECT A.BSM FROM DTBDLTBGX A
// // LEFT JOIN (SELECT BGHTBBSM,SUM(TBBGMJ) AS MJ FROM DTBDLTBGXGC
// // where TBBSM='{TBBSM}' AND BGQDLBM<>BGHDLBM GROUP BY BGHTBBSM) B ON A.BSM=B.BGHTBBSM WHERE A.TBBSM='{TBBSM}'
// // AND B.MJ/A.TBMJ>0.99 AND (SFGX<>DLBM or (substr(DLBM,0,4)<>SFGX))";
// DataTable dataTable = SQLiteDBOperate.Instance.ExceDataTable(this.SourcePath, sql);
// if (dataTable != null && dataTable.Rows.Count > 0)
// {
// foreach (DataRow item in dataTable.Rows)
// {
// result.Add(new RuleEntity()
// {
// CheckObject = "DTBDLTBGX",
// ErrorId = item[0].ToString(),
// BGFWBSM = item[0].ToString(),
// ErrorTip = "变化图斑“是否更新”字段应填写相应地类编码",
// ErrorType = "一类错误",
// RuleCode = "JZ008",
// RuleName = "变化图斑变更信息填写检查",
// RuleContent = "DTBDLTBGX层图斑相对于基础库变化部分的面积占图斑面积的比例在10%及以上时,若“是否更新”字段值不为相应“地类编码”,认定为错误图斑。"
// });
// }
// }
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "DTBDLTBGX",
ErrorId = this.TBBSM,
ErrorTip = "变化图斑“是否更新”字段应为“整图斑变更”。规则检查失败:" + ex.Message,
ErrorType = "一类错误",
RuleCode = "JZ008",
RuleName = "变化图斑变更信息填写检查",
RuleContent = "DTBDLTBGX层图斑相对于基础库变化部分的面积占DTBDLTBGX层图斑面积的比例在90%及以上时,若“是否更新”字段值不为“整图斑变更”,认定为错误图斑。"
};
result.Add(ruleEntity);
}
return result;
}
public List<RuleEntity> JZ009()
{
List<RuleEntity> result = new List<RuleEntity>();
try
{
//2021/8/4修改 SELECT A.BSM FROM DTBDLTBGX A LEFT JOIN (SELECT BGHTBBSM,SUM(TBBGMJ) AS MJ FROM DTBDLTBGXGC GROUP BY BGHTBBSM) B ON A.BSM=B.BGHTBBSM WHERE B.MJ/A.TBMJ<0.1 AND SFGX<>'否'
//2021/8/19修改 SELECT A.BSM,B.MJ/A.TBMJ FROM DTBDLTBGX A LEFT JOIN (SELECT BGHTBBSM,SUM(TBBGMJ) AS MJ FROM DTBDLTBGXGC S where S.BGHZZSXDM=S.BGQZZSXDM AND S.BGHTBXHDM=S.BGQTBXHDM AND (S.BGQDLBM=s.BGHDLBM or (s.BGHDLBM in ('0404A','1001A','1002A','1003A','1004A') and left(BGHDLBM,4)=S.BGQDLBM)) group by BGHTBBSM) B ON A.BSM=B.BGHTBBSM WHERE B.MJ/A.TBMJ>0.9 AND SFGX<>'否'
var sql = $"SELECT A.BSM,B.MJ/A.TBMJ FROM DTBDLTBGX A LEFT JOIN (SELECT BGHTBBSM,SUM(TBBGMJ) AS MJ FROM DTBDLTBGXGC S where S.BGHZZSXDM=S.BGQZZSXDM AND S.BGHTBXHDM=S.BGQTBXHDM AND (S.BGQDLBM=s.BGHDLBM or (s.BGHDLBM in ('0404A','1001A','1002A','1003A','1004A') and substr(BGHDLBM,0,4)=S.BGQDLBM)) group by BGHTBBSM) B ON A.BSM=B.BGHTBBSM WHERE A.TBBSM='{TBBSM}' AND B.MJ/A.TBMJ>0.9 AND SFGX<>'未变更' and a.dlbm not like '99%'";
DataTable dataTable = SQLiteDBOperate.Instance.ExceDataTable(this.SourcePath, sql);
if (dataTable != null && dataTable.Rows.Count > 0)
{
foreach (DataRow item in dataTable.Rows)
{
result.Add(new RuleEntity()
{
CheckObject = "DTBDLTBGX",
ErrorId = item[0].ToString(),
BGFWBSM = item[0].ToString(),
ErrorTip = "未变化图斑“是否更新”字段应填写“未变更”",
ErrorType = "一类错误",
RuleCode = "JZ009",
RuleName = "未变化图斑变更信息填写检查",
RuleContent = "单图斑填写“地类编码”“种植属性代码”“图斑细化代码”【“地类编码”必填,“种植属性代码”“图斑细化代码”可以为空,为空时默认为已填写】,将这三个属性与单图斑叠加到的基础库图斑“地类编码”“种植属性代码”“图斑细化代码”进行比较,完全一致的部分认定为“未变化部分”【其中单图斑为0404A、1001A、1002A、1003A、1004A默认与基础库0404、1001、1002、1003、1004相同】,当“未变化部分”面积之和A占单图斑面积的比例大于等于90%时,若“是否更新”不为“未变更”认定为错误。"
});
}
}
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "DTBDLTBGX",
ErrorId = this.TBBSM,
ErrorTip = "未变化图斑“是否更新”字段应填写“部分变更”规则检查失败:" + ex.Message,
ErrorType = "一类错误",
RuleCode = "JZ009",
RuleName = "未变化图斑变更信息填写检查",
RuleContent = "DTBDLTBGX层图斑相对于基础库变化部分的面积占图斑面积的比例在10%以下时,若“是否更新”字段值不为“部分变更”,认定为错误图斑。"
};
result.Add(ruleEntity);
}
return result;
}
public List<RuleEntity> JZ010()
{
List<RuleEntity> result = new List<RuleEntity>();
try
{
var sql = $"select gx.bsm from DTBDLTBGX gx where gx.TBBSM='{TBBSM}'and gx.dlbm not like '99%' and gx.TBLX='外业图斑' and gx.LJLX NOT IN ('类举举证','承诺举证','军事用地','实地无法到达','图斑不够上图面积','影像支持')";
DataTable dataTable = SQLiteDBOperate.Instance.ExceDataTable(this.SourcePath, sql);
if (dataTable != null && dataTable.Rows.Count > 0)
{
foreach (DataRow item in dataTable.Rows)
{
result.Add(new RuleEntity()
{
CheckObject = "DTBDLTBGX",
ErrorId = item[0].ToString(),
BGFWBSM = item[0].ToString(),
ErrorTip = "外业图斑必须实地举证或标注类举类型",
ErrorType = "一类错误",
RuleCode = "JZ010",
RuleName = "图斑修改类型与图斑预编号逻辑性检查",
RuleContent = "若DLTB层图斑类型为“JZ”时,必须存在实地举证照片或“类举类型”字段为“类举举证”、“承诺举证”、“军事用地”、“实地无法到达”、“图斑不够上图面积”;否则,判定为错误图斑。"
});
}
}
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "DTBDLTBGX",
ErrorId = this.TBBSM,
ErrorTip = "外业图斑必须实地举证或标注类举类型规则检查失败:" + ex.Message,
ErrorType = "一类错误",
RuleCode = "JZ010",
RuleName = "图斑修改类型与图斑预编号逻辑性检查",
RuleContent = "若DLTB层图斑类型为“JZ”时,必须存在实地举证照片或“类举类型”字段为“类举举证”、“承诺举证”、“军事用地”、“实地无法到达”、“图斑不够上图面积”;否则,判定为错误图斑。"
};
result.Add(ruleEntity);
}
return result;
}
//public List<RuleEntity> JZ011()
//{
// List<RuleEntity> result = new List<RuleEntity>();
// try
// {
// DataTable dataTable = this.mdbHelper.ExecuteDataTable($"SELECT BSM FROM DTBDLTBGX WHERE TBLX='外业图斑' AND LJLX IS NOT NULL AND LJLX NOT IN ('类举','承诺举证','军事用地','无法到达')");
// 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 = "JZ011",
// RuleName = "图斑修改类型与图斑类举类型逻辑性检查",
// RuleContent = "当“图斑类型”为“外业图斑”时,“类举类型”字段若不为空,字段值需为“类举”、“承诺举证”、“军事用地”、“无法到达”其中之一;否则,认定为错误图斑。"
// });
// }
// }
// }
// catch (Exception ex)
// {
// RuleEntity ruleEntity = new RuleEntity()
// {
// CheckObject = "DTBDLTBGX",
// ErrorId = "规则检查失败:" + ex.Message,
// ErrorTip = "外业修改图斑若标注类举类型,只可为“类举”、“承诺举证”、“军事用地”、“无法到达”其中之一",
// ErrorType = "一类错误",
// RuleCode = "JZ011",
// RuleName = "图斑修改类型与图斑类举类型逻辑性检查",
// RuleContent = "当“图斑类型”为“外业图斑”时,“类举类型”字段若不为空,字段值需为“类举”、“承诺举证”、“军事用地”、“无法到达”其中之一;否则,认定为错误图斑。"
// };
// result.Add(ruleEntity);
// }
// return result;
//}
public List<RuleEntity> JZ012()
{
List<RuleEntity> result = new List<RuleEntity>();
try
{
string sql = $"SELECT BSM FROM DTBDLTBGX WHERE TBBSM='{TBBSM}'and dlbm not like '99%' and SFJZ='否' AND length(replace(QKSM,' ',''))<5";
DataTable dataTable = SQLiteDBOperate.Instance.ExceDataTable(this.SourcePath, sql);
if (dataTable != null && dataTable.Rows.Count > 0)
{
foreach (DataRow item in dataTable.Rows)
{
result.Add(new RuleEntity()
{
CheckObject = "DTBDLTBGX",
ErrorId = item[0].ToString(),
BGFWBSM = item[0].ToString(),
ErrorTip = "未举证图斑必须填写情况说明,且内容长度不可小于5",
ErrorType = "一类错误",
RuleCode = "JZ012",
RuleName = "“是否举证”填写情况逻辑性检查",
RuleContent = "若图斑字段“是否举证”列为“否”,“情况说明”字段为空或长度小于5,判定为错误图斑。"
});
}
}
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "DTBDLTBGX",
ErrorId = this.TBBSM,
ErrorTip = "未举证图斑必须填写情况说明规则检查失败:" + ex.Message,
ErrorType = "一类错误",
RuleCode = "JZ012",
RuleName = "“是否举证”填写情况逻辑性检查",
RuleContent = "若图斑字段“是否举证”列为“否”,“情况说明”字段为空或长度小于5,判定为错误图斑。"
};
result.Add(ruleEntity);
}
return result;
}
public List<RuleEntity> JZ013()
{
List<RuleEntity> result = new List<RuleEntity>();
try
{
DataTable dataTable = SQLiteDBOperate.Instance.ExceDataTable(this.SourcePath, $"SELECT BSM FROM DTBDLTBGX WHERE TBBSM='{TBBSM}'and dlbm not like '99%' and SFGX='未变更' AND (WBGYY IS NULL OR length(replace(WBGYY,' ',''))<5) and WBGYY not in('J1','J2','J3','J4','J5','J6','J7','J8','J9','G1','G2','G3','G4','G5')");
if (dataTable != null && dataTable.Rows.Count > 0)
{
foreach (DataRow item in dataTable.Rows)
{
result.Add(new RuleEntity()
{
CheckObject = "DTBDLTBGX",
ErrorId = item[0].ToString(),
BGFWBSM = item[0].ToString(),
ErrorTip = "未变化图斑必须填写未更新原因(值若不是J1、J2、J3、J4、J5、J6、J7、J8、J9、G1、G2、G3、G4、G5其中之一,则长度需大于5)",
ErrorType = "一类错误",
RuleCode = "JZ013",
RuleName = "未变化图斑逻辑性检查",
RuleContent = "若图斑字段“是否更新”列为“未变更”时,“未更新原因”字段必须为J1、J2、J3、J4、J5、J6、J7、J8、J9、G1、G2、G3、G4、G5其中之一;若不为以上值域时,“未更新原因”字段值必须大于5个字符。否则,判定为错误图斑。"
});
}
}
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "DTBDLTBGX",
ErrorId = this.TBBSM,
ErrorTip = "未变化图斑必须填写未更新原因(值若不是J1、J2、J3、J4、J5、J6、J7、J8、J9、G1、G2、G3、G4、G5其中之一,则长度需大于5)规则检查失败:" + ex.Message,
ErrorType = "一类错误",
RuleCode = "JZ013",
RuleName = "未变化图斑逻辑性检查",
RuleContent = "若图斑字段“是否更新”列为“否”时,“未更新原因”字段必须为J1、J2、J3、J4、J5、J6、J7、J8、J9、G1、G2、G3、G4、G5其中之一;若不为以上值域时,“未更新原因”字段值必须大于5个字符。否则,判定为错误图斑。"
};
result.Add(ruleEntity);
}
return result;
}
public List<RuleEntity> WYZP011()
{
List<RuleEntity> result = new List<RuleEntity>();
List<string> bsmList = new List<string>();
List<string> groupCode = new List<string>() { "YBZP", "TZZP", "CNZP", "WTZP" };
List<string> mode = new List<string>() { "7", "9" };
try
{
string sql = $@"select bsm from DTBDLTBGX where TBBSM='{TBBSM}'
AND LJLX in ('', '', '') AND DLBM NOT IN('9902','9903','9904')";
System.Data.DataTable dataTable = SQLiteDBOperate.Instance.ExceDataTable(this.SourcePath, sql);
if (dataTable != null && dataTable.Rows.Count > 0)
{
foreach (DataRow item in dataTable.Rows)
{
string bgfwBsm = item[0].ToString();
sql = $@"select f.TBBSM,GROUPCODE,MODE from FJGX f left join WYHCFJ w on f.FJARG=w.ARG where f.TBBSM='{bgfwBsm}' and hcjlbsm= '{TBBSM}'";
dataTable = SQLiteDBOperate.Instance.ExceDataTable(this.SourcePath, sql);
if (dataTable != null && dataTable.Rows.Count > 0)
{
var state = dataTable.AsEnumerable();
int notWrjzp = state.Count(x => (groupCode.Contains(x.Field<string>("GROUPCODE")) || string.IsNullOrEmpty(x.Field<string>("GROUPCODE"))) && !mode.Contains(x.Field<string>("MODE")));
int wrjzp = state.Count(x => groupCode.Contains(x.Field<string>("GROUPCODE")) && mode.Contains(x.Field<string>("MODE")));
if ((notWrjzp < 3 || notWrjzp > 30) && wrjzp == 0)
bsmList.Add(item[0].ToString());
else if (wrjzp < 2 && notWrjzp == 0)
bsmList.Add(item[0].ToString());
else if (notWrjzp >= 3 || wrjzp >= 2)
continue;
else
bsmList.Add(item[0].ToString());
}
else
bsmList.Add(bgfwBsm);
}
}
if (bsmList.Count > 0)
{
foreach (var item in bsmList)
{
result.Add(new RuleEntity()
{
CheckObject = "外业举证照片",
ErrorId = item,
BGFWBSM = item,
ErrorTip = "非类举类型的外业图斑,举证照片为无人机举证时总数不可少于2张,无人机以外的举证方式时,总数不可少于3张",
ErrorType = "一类错误",
RuleCode = "WYZP011",
RuleName = "举证照片总数量检查",
RuleContent = "非类举类型的外业图斑,举证照片为无人机举证时总数不可少于2张,无人机以外的举证方式时,总数不可少于3张"
});
}
}
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "外业举证照片",
ErrorId = this.TBBSM,
ErrorTip = "非类举类型的外业图斑,举证照片为无人机举证时总数不可少于2张,无人机以外的举证方式时,总数不可少于3张。规则检查失败:" + ex.Message,
ErrorType = "一类错误",
RuleCode = "WYZP011",
RuleName = "举证照片总数量检查",
RuleContent = "非类举类型的外业图斑,举证照片为无人机举证时总数不可少于2张,无人机以外的举证方式时,总数不可少于3张"
};
result.Add(ruleEntity);
}
return result;
}
public List<RuleEntity> BCSM001()
{
List<RuleEntity> result = new List<RuleEntity>();
try
{
string sql = $"select bsm from DTBDLTBGX where TBBSM='{TBBSM}' and dlbm not like '99%' and LJLX='农变未' and length(replace(NBWQKSM,' ',''))<10";
System.Data.DataTable dataTable = SQLiteDBOperate.Instance.ExceDataTable(this.SourcePath, sql);
if (dataTable != null && dataTable.Rows.Count > 0)
{
foreach (DataRow item in dataTable.Rows)
{
result.Add(new RuleEntity()
{
CheckObject = "DTBDLTBGX",
ErrorId = item[0].ToString(),
BGFWBSM = item[0].ToString(),
ErrorTip = "标记“农变未”的图斑,“农变未情况说明”字段内容长度不可小于10",
ErrorType = "一类错误",
RuleCode = "BCSM001",
RuleName = "农变未图斑农变未情况说明逻辑性检查",
RuleContent = "对于DTBDLTBGX层,若图斑“未举证类型”为“农变未”时,“农变未情况说明”字段长度不可小于10;否则,判定为错误图斑。"
});
}
}
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "DTBDLTBGX",
ErrorId = this.TBBSM,
ErrorTip = "标记“农变未”的图斑,“农变未情况说明”字段内容长度不可小于10规则检查失败:" + ex.Message,
ErrorType = "一类错误",
RuleCode = "BCSM001",
RuleName = "农变未图斑农变未情况说明逻辑性检查",
RuleContent = "对于DTBDLTBGX层,若图斑“未举证类型”为“农变未”时,“农变未情况说明”字段长度不可小于10;否则,判定为错误图斑。"
};
result.Add(ruleEntity);
}
return result;
}
public List<RuleEntity> BCSM002()
{
List<RuleEntity> result = new List<RuleEntity>();
try
{
string sql = $"select bsm from DTBDLTBGX where TBBSM='{TBBSM}' and dlbm not like '99%' and LJLX='水旱轮作' and length(replace(SHLZQKSM,' ',''))<10";
System.Data.DataTable dataTable = SQLiteDBOperate.Instance.ExceDataTable(this.SourcePath, sql);
if (dataTable != null && dataTable.Rows.Count > 0)
{
foreach (DataRow item in dataTable.Rows)
{
result.Add(new RuleEntity()
{
CheckObject = "DTBDLTBGX",
ErrorId = item[0].ToString(),
BGFWBSM = item[0].ToString(),
ErrorTip = "标记“水旱轮作”的图斑,“水旱轮作情况说明”字段内容长度不可小于10",
ErrorType = "一类错误",
RuleCode = "BCSM002",
RuleName = "水旱轮作图斑水旱轮作情况说明逻辑性检查",
RuleContent = "对于DTBDLTBGX层,若图斑“未举证类型”为“水旱轮作”时,“水旱轮作情况说明”字段长度不可小于10;否则,判定为错误图斑。"
});
}
}
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "DTBDLTBGX",
ErrorId = this.TBBSM,
ErrorTip = "标记“水旱轮作”的图斑,“水旱轮作情况说明”字段内容长度不可小于10规则检查失败:" + ex.Message,
ErrorType = "一类错误",
RuleCode = "WYZP011",
RuleName = "水旱轮作图斑水旱轮作情况说明逻辑性检查",
RuleContent = "对于DTBDLTBGX层,若图斑“未举证类型”为“水旱轮作”时,“水旱轮作情况说明”字段长度不可小于10;否则,判定为错误图斑。"
};
result.Add(ruleEntity);
}
return result;
}
public List<RuleEntity> JZ014()
{
List<RuleEntity> result = new List<RuleEntity>();
return result;
try
{
DataTable dataTable = SQLiteDBOperate.Instance.ExceDataTable(this.SourcePath, $"select BGHTBBSM from DTBDLTBGXGC where TBBSM='{TBBSM}' AND BGQDLBM IN ('0101') and bghdlbm in ('0102','0103') and (TBBGMJ>2000 or TBBGMJ/BGQTBDLMJ>0.3) and (BGHTBBSM not in(select tbbsm FROM FJGX group by tbbsm having count(tbbsm) >0) or BGHTBBSM not in (select bsm FROM DTBDLTBGX where ljlx='水旱轮作' and dlbm not like '99%'))");
if (dataTable != null && dataTable.Rows.Count > 0)
{
foreach (DataRow item in dataTable.Rows)
{
result.Add(new RuleEntity()
{
CheckObject = "DTBDLTBGX",
ErrorId = item[0].ToString(),
BGFWBSM = item[0].ToString(),
ErrorTip = "水旱轮作图斑必须标注“水旱轮作”且存在实地举证照片",
ErrorType = "二类错误",
RuleCode = "JZ014",
RuleName = "水旱轮作与举证照片逻辑性检查",
RuleContent = "对于DTBDLTBGXGC层中,变更前地类为水田、变更后地类旱地或水浇地的,当面积大于等于2000平方米,或占原图斑面积超过30%时,若相应DTBDLTBGX层图斑“类举类型”字段不为“水旱轮作”,认定为错误图斑。若相应DTBDLTBGX层图斑不存在实地举证照片,认定为错误图斑"
});
}
}
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "DTBDLTBGX",
ErrorId = this.TBBSM,
ErrorTip = "水旱轮作图斑必须标注“水旱轮作”且存在实地举证照片规则检查失败:" + ex.Message,
ErrorType = "二类错误",
RuleCode = "JZ014",
RuleName = "水旱轮作与举证照片逻辑性检查",
RuleContent = "对于DTBDLTBGXGC层中,变更前地类为水田、变更后地类旱地或水浇地的,当面积大于等于2000平方米,或占原图斑面积超过30%时,若相应DTBDLTBGX层图斑“类举类型”字段不为“水旱轮作”,认定为错误图斑。若相应DTBDLTBGX层图斑不存在实地举证照片,认定为错误图斑"
};
result.Add(ruleEntity);
}
return result;
}
/// <summary>
/// 农用地变未利用地图斑与举证照片逻辑性检查
/// </summary>
/// <returns></returns>
public List<RuleEntity> JZ041()
{
List<RuleEntity> result = new List<RuleEntity>();
try
{
string sql = $@"select DISTINCT a.bsm from dtbdltbgx as a
left join dtbdltbgxgc as b on a.bsm = b.bghtbbsm
where a.LJLX='' and a.tbbsm ='{TBBSM}' and a.dlbm not like '99%' AND (b.BGQDLBM not IN ({DLParams.nyd_dlbms}) or b.bghdlbm not in({DLParams.wlyd_dlbms}))";
sql = $"select bsm from dtbdltbgx where tbbsm ='{TBBSM}'and dlbm not like '99%' and LJLX='农变未' and bsm not in (select BGHTBBSM from dtbdltbgxgc where tbbsm ='{TBBSM}' AND (BGQDLBM 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') and bghdlbm in('0404','0404A','1101','1102','1105','1106','1108','1110','1204','1205','1206','1207')))";
DataTable dataTable = SQLiteDBOperate.Instance.ExceDataTable(this.SourcePath, sql);
if (dataTable != null && dataTable.Rows.Count > 0)
{
foreach (DataRow item in dataTable.Rows)
{
result.Add(new RuleEntity()
{
CheckObject = "DTBDLTBGX",
ErrorId = item[0].ToString(),
BGFWBSM = item[0].ToString(),
ErrorTip = "“类举类型”标注为“农变未”的图斑,变更前需为农用地,变更后需为未利用地",
ErrorType = "一类错误",
RuleCode = "JZ041",
RuleName = "农用地变未利用地图斑与举证照片逻辑性检查",
RuleContent = "当相应DTBDLTBGX层图斑“类举类型”字段为“农变未”时,若相应DTBDLTBGXGC层中,不存在变更前地类不为农用地(地类编码属于01-03、0401-0403、1006、1103-1104、1107、1202-1203的),或变更后地类编码不为0404、0404A、1101、1102、1105、1106、1108、1204、1205、1206、1207的,认定为错误图斑。"
});
}
}
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "DTBDLTBGX",
ErrorId = this.TBBSM,
ErrorTip = "JZ041规则执行失败:" + ex.Message,
ErrorType = "一类错误",
RuleCode = "JZ041",
RuleName = "农用地变未利用地图斑与举证照片逻辑性检查",
RuleContent = "当相应DTBDLTBGX层图斑“类举类型”字段为“农变未”时,若相应DTBDLTBGXGC层中,不存在变更前地类不为农用地(地类编码属于01-03、0401-0403、1006、1103-1104、1107、1202-1203的),或变更后地类编码不为0404、0404A、1101、1102、1105、1106、1108、1204、1205、1206、1207的,认定为错误图斑。"
};
result.Add(ruleEntity);
}
return result;
}
public List<RuleEntity> SM201()
{
List<RuleEntity> result = new List<RuleEntity>();
return result;
try
{
DataTable dataTable = SQLiteDBOperate.Instance.ExceDataTable(this.SourcePath, $"SELECT BSM FROM DTBDLTBGX WHERE TBBSM='{TBBSM}' AND length(replace(SDMSSM,' ',''))<=5");
if (dataTable != null && dataTable.Rows.Count > 0)
{
foreach (DataRow item in dataTable.Rows)
{
result.Add(new RuleEntity()
{
CheckObject = "DTBDLTBGX",
ErrorId = item[0].ToString(),
BGFWBSM = item[0].ToString(),
ErrorTip = "整改阶段,实地描述说明不可为空且必须大于10个字符",
ErrorType = "一类错误",
RuleCode = "SM201",
RuleName = "实地描述说明检查",
RuleContent = "实地描述说明字段必须大于10个字符。"
});
}
}
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "DTBDLTBGX",
ErrorId = this.TBBSM,
ErrorTip = "实地描述说明检查失败:" + ex.Message,
ErrorType = "一类错误",
RuleCode = "SM201",
RuleName = "实地描述说明检查",
RuleContent = "实地描述说明字段必须大于10个字符。"
};
result.Add(ruleEntity);
}
return result;
}
public List<RuleEntity> JZ020()
{
List<RuleEntity> result = new List<RuleEntity>();
//return result;
try
{
DataTable dataTable = SQLiteDBOperate.Instance.ExceDataTable(this.SourcePath, $"select bsm from DTBDLTBGX WHERE TBBSM='{TBBSM}' and dlbm not like '99%' and substr(TBBSM,7,4)='WYHC' and (LJLX<>'类举举证' or (SDMSSM='' or SDMSSM IS NULL))");
if (dataTable != null && dataTable.Rows.Count > 0)
{
foreach (DataRow item in dataTable.Rows)
{
result.Add(new RuleEntity()
{
CheckObject = "DTBDLTBGX",
ErrorId = item[0].ToString(),
BGFWBSM = item[0].ToString(),
ErrorTip = "国家外业实地核查图斑必须标注“类举举证”且填写“实地描述说明”",
ErrorType = "一类错误",
RuleCode = "JZ020",
RuleName = "国家外业实地核查图斑逻辑性检查",
RuleContent = "国家外业实地核查图斑必须标注“类举举证”且填写“实地描述说明”。"
});
}
}
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "DTBDLTBGX",
ErrorId = this.TBBSM,
ErrorTip = "国家外业实地核查图斑逻辑性检查:" + ex.Message,
ErrorType = "一类错误",
RuleCode = "JZ020",
RuleName = "实地描述说明检查",
RuleContent = "国家外业实地核查图斑必须标注“类举举证”且填写“实地描述说明”。"
};
result.Add(ruleEntity);
}
return result;
}
public List<RuleEntity> WYZP004()
{
bool ischck = false;
string bsm = string.Empty;
List<RuleEntity> result = new List<RuleEntity>();
try
{
DataTable dataTable = SQLiteDBOperate.Instance.ExceDataTable(this.SourcePath, $"select t.BSM,CJSJ from DTBDLTBGX t inner join FJGX f on t.BSM=f.TBBSM left join WYHCFJ w on f.FJARG=w.ARG where t.TBBSM='{TBBSM}'and t.dlbm not like '99%'");
if (dataTable != null && dataTable.Rows.Count > 0)
{
foreach (DataRow item in dataTable.Rows)
{
if (!string.IsNullOrEmpty(item["CJSJ"].ToString()))
{
TimeSpan ts = Convert.ToDateTime(DateTime.Now.ToString("2024-01-01 00:00:00")) - Convert.ToDateTime(item["CJSJ"]);
if (ts.Days > 365)
{
bsm = item["BSM"].ToString();
ischck = true;
break;
}
}
}
}
if (ischck)
{
result.Add(new RuleEntity()
{
CheckObject = "外业举证照片",
ErrorId = bsm,
BGFWBSM = bsm,
ErrorTip = "举证照片拍摄时间不在有效时间内,请核实或重新拍摄。",
ErrorType = "一类错误",
RuleCode = "WYZP004",
RuleName = "举证照片时间范围检查",
RuleContent = "举证照片拍摄时间不在有效时间内,请核实或重新拍摄。"
});
}
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "外业举证照片",
ErrorId = bsm,
ErrorTip = "举证照片拍摄时间不在有效时间内,请核实或重新拍摄。" + ex.Message,
ErrorType = "一类错误",
RuleCode = "WYZP004",
RuleName = "举证照片时间范围检查",
RuleContent = "举证照片拍摄时间不在有效时间内,请核实或重新拍摄。"
};
result.Add(ruleEntity);
}
return result;
}
public List<RuleEntity> JZ002()
{
List<string> bsm = new List<string>();
List<RuleEntity> result = new List<RuleEntity>();
try
{
DataTable dataTable = SQLiteDBOperate.Instance.ExceDataTable(this.SourcePath, $"select DISTINCT( t.bsm )from DTBDLTBGX t where t.DDTCBZ in('1301','1303','1304') and (t.LJLX='' or t.LJLX NOT IN('两期影像一致','影像支持')) and t.TBBSM='{TBBSM}' and t.dlbm not like '99%' and t.bsm not in(select DISTINCT( tbbsm) from fjgx where WYTBBSM='{TBBSM}')");
if (dataTable != null && dataTable.Rows.Count > 0)
{
foreach (DataRow item in dataTable.Rows)
{
bsm.Add(item["bsm"].ToString());
}
}
dataTable = SQLiteDBOperate.Instance.ExceDataTable(this.SourcePath, $"select DISTINCT( t.bsm )from DTBDLTBGX t where t.DDTCBZ='1302' and (t.LJLX='' or t.LJLX NOT IN('两期影像一致')) and t.TBBSM='{TBBSM}' and t.bsm not in(select DISTINCT( tbbsm) from fjgx where WYTBBSM='{TBBSM}')");
if (dataTable != null && dataTable.Rows.Count > 0)
{
foreach (DataRow item in dataTable.Rows)
{
bsm.Add(item["bsm"].ToString());
}
}
foreach (var item in bsm)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "DTBDLTBGX层",
BGFWBSM = item,
ErrorId = item,
ErrorTip = "临时用地、推土区、拆除未尽区图斑必须进行外业实地举证,或标记“两期影像一致”“影像支持”。",
ErrorType = "一类错误",
RuleCode = "JZ002",
RuleName = "独立图层图斑与举证照片逻辑性检查",
RuleContent = "对于“独立图层代码”字段值域为“1301”、“1303”或“1304”的图斑,“类举类型”字段需为“空”、“两期影像一致”、“影像支持”。当类举类型为空时,若不存在实地举证照片,认定为错误图斑。对于“独立图层代码”字段值域为“1302”的图斑,“类举类型”字段需为“空”或“两期影像一致”。当类举类型为空时,若不存在实地举证照片,认定为错误图斑。"
};
result.Add(ruleEntity);
}
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "DTBDLTBGX层",
ErrorId = this.TBBSM,
ErrorTip = "临时用地、推土区、拆除未尽区图斑必须进行外业实地举证,或标记“两期影像一致”“影像支持”。光伏板区必须进行外业实地举证,或标记“两期影像一致”。" + ex.Message,
ErrorType = "一类错误",
RuleCode = "JZ002",
RuleName = "独立图层图斑与举证照片逻辑性检查",
RuleContent = "对于“独立图层代码”字段值域为“1301”、“1303”或“1304”的图斑,“类举类型”字段需为“空”、“两期影像一致”、“影像支持”。当类举类型为空时,若不存在实地举证照片,认定为错误图斑。对于“独立图层代码”字段值域为“1302”的图斑,“类举类型”字段需为“空”或“两期影像一致”。当类举类型为空时,若不存在实地举证照片,认定为错误图斑。"
};
result.Add(ruleEntity);
}
return result;
}
public List<RuleEntity> JZ015()
{
List<RuleEntity> result = new List<RuleEntity>();
IFeatureClass jc_dltbFeatureClass = null;
IGeometry dltbGXgeo = null;
IFeatureCursor pCursor = null;
IFeature feature = null;
try
{
DataTable dataTable = CheckHelper.SQLiteDBOperate.Instance.ExceDataTable(this.SourcePath, $"select * from dtbdltbgx where tbbsm='{TBBSM}' and dlbm not like '99%' and sfgx<>'部分变更'");
if (dataTable == null || dataTable.Rows.Count <= 0)
return result;
if (!DicFeatureClass.ContainsKey("JC_DLTB") || DicFeatureClass["JC_DLTB"] == null)
{
throw new Exception("未找到“基础_地类图斑”参考图层!");
}
jc_dltbFeatureClass = DicFeatureClass["JC_DLTB"];
ISpatialFilter spatialFilter = new SpatialFilterClass
{
SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects
};
ISpatialReference spatialReference = (jc_dltbFeatureClass as IGeoDataset).SpatialReference;
//Console.WriteLine(spatialReference.Name);
if (spatialReference == null)
{
throw new Exception("基础_地类图斑数据坐标参考为空,质检失败!");
}
foreach (DataRow item in dataTable.Rows)
{
dltbGXgeo = CheckHelper.GeometryConvertHelper.ConverJsonToIGeoemtry(item["egeometry"].ToString(), esriGeometryType.esriGeometryPolygon);
dltbGXgeo.Project(spatialReference);
IArea geoArea = dltbGXgeo as IArea;
double area = geoArea.Area;
spatialFilter.Geometry = dltbGXgeo;
spatialFilter.WhereClause = null;
pCursor = jc_dltbFeatureClass.Search(spatialFilter, true);
ITopologicalOperator topological = null;
while ((feature = pCursor.NextFeature()) != null)
{
if (topological == null)
{
topological = feature.ShapeCopy as ITopologicalOperator;
}
else
{
topological = topological.Union(feature.ShapeCopy) as ITopologicalOperator;
}
}
IGeometry GGeometry = null;
double GArea = 0;
IGeometry EGeometry = topological as IGeometry;
if (EGeometry != null && !EGeometry.IsEmpty)
{
topological = EGeometry as ITopologicalOperator;
if (EGeometry.SpatialReference == null)
{
EGeometry.SpatialReference = spatialReference;
}
GGeometry = CommonHelper.InterSect(dltbGXgeo, EGeometry);
GArea = (GGeometry as IArea).Area;
}
if (GArea / area > 0.1 && GArea / area < 0.9)
{
result.Add(new RuleEntity()
{
CheckObject = "DTBDLTBGX",
ErrorId = item["bsm"].ToString(),
BGFWBSM = item["bsm"].ToString(),
ErrorTip = "未变化图斑“是否更新”字段应填写“部分变更”。",
ErrorType = "一类错误",
RuleCode = "JZ015",
RuleName = "变化图斑变更信息填写检查",
RuleContent = "DTBDLTBGX层图斑相对于基础库变化部分的面积占DTBDLTBGX层图斑面积的比例在10%-90%时,若“是否更新”字段值不为“部分变更”,认定为错误图斑。"
});
}
}
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "DTBDLTBGX",
ErrorId = this.TBBSM,
ErrorTip = "未变化图斑“是否更新”字段应填写“部分变更”。规则检查失败:" + ex.Message,
ErrorType = "一类错误",
RuleCode = "JZ015",
RuleName = "变化图斑变更信息填写检查",
RuleContent = "DTBDLTBGX层图斑相对于基础库变化部分的面积占DTBDLTBGX层图斑面积的比例在10%-90%时,若“是否更新”字段值不为“部分变更”,认定为错误图斑。"
};
result.Add(ruleEntity);
}
return result;
}
public List<RuleEntity> JZ016()
{
List<RuleEntity> result = new List<RuleEntity>();
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "DTBDLTBGX",
ErrorId = this.TBBSM,
ErrorTip = "疑似新增建设用地未变化图斑值域填写不符合要求",
ErrorType = "一类错误",
RuleCode = "JZ016",
RuleName = "疑似新增建设用地未变化图斑逻辑性检查",
RuleContent = "若任务图斑为监测图斑,且监测类型为“疑似新增建设用地监测图斑层”,当图斑字段“是否更新”列为“未变更”时,“未更新原因”字段必须为J1、J2、J31、J4、J5、J6、J7、J8、J9其中之一。否则,判定为错误图斑。"
};
try
{
DataTable dataTable = SQLiteDBOperate.Instance.ExceDataTable(this.SourcePath, $"select gx.BSM from DTBDLTBGX gx left join WYRW wy on gx.tbbsm=wy.tbbsm where gx.tbbsm='{TBBSM}' and JCDL='XZJS' and SFGX='未变更' and (WBGYY in ('G1','G2','G3','G4','G5') or WBGYY=''or WBGYY IS NULL) and gx.dlbm not like '99%'");
if (dataTable != null && dataTable.Rows.Count > 0)
{
foreach (DataRow item in dataTable.Rows)
{
result.Add(new RuleEntity()
{
CheckObject = ruleEntity.CheckObject,
ErrorId = item[0].ToString(),
BGFWBSM = item[0].ToString(),
ErrorTip = ruleEntity.ErrorTip,
ErrorType = ruleEntity.ErrorType,
RuleCode = ruleEntity.RuleCode,
RuleName = ruleEntity.RuleName,
RuleContent = ruleEntity.RuleContent,
});
}
}
}
catch (Exception ex)
{
ruleEntity.ErrorTip = "疑似新增建设用地未变化图斑逻辑性检查:" + ex.Message;
result.Add(ruleEntity);
}
return result;
}
public List<RuleEntity> JZ017()
{
List<RuleEntity> result = new List<RuleEntity>();
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "DTBDLTBGX",
ErrorId = this.TBBSM,
ErrorTip = "耕地监测图斑未变化情况值域填写不符合要求",
ErrorType = "一类错误",
RuleCode = "JZ017",
RuleName = "耕地监测图斑未变化逻辑性检测",
RuleContent = "若任务图斑为监测图斑,且监测类型为“监测耕地变化状况图斑层”,当图斑字段“是否更新”列为“未变更”时,“未更新原因”字段必须为G1、G2、G3、G4、G5其中之一。否则,判定为错误图斑。"
};
try
{
DataTable dataTable = SQLiteDBOperate.Instance.ExceDataTable(this.SourcePath, $"select gx.BSM from DTBDLTBGX gx left join WYRW wy on gx.tbbsm=wy.tbbsm where gx.tbbsm='{TBBSM}' and JCDL='GDBH' and SFGX='未变更' and (WBGYY in ('J1','J2','J3','J4','J5','J6','J7','J8','J9') or WBGYY=''or WBGYY IS NULL) and gx.dlbm not like '99%'");
if (dataTable != null && dataTable.Rows.Count > 0)
{
foreach (DataRow item in dataTable.Rows)
{
ruleEntity.BGFWBSM = ruleEntity.ErrorId = item[0].ToString();
result.Add(new RuleEntity()
{
CheckObject = ruleEntity.CheckObject,
BGFWBSM = item["bsm"].ToString(),
ErrorId = ruleEntity.ErrorId,
ErrorTip = ruleEntity.ErrorTip,
ErrorType = ruleEntity.ErrorType,
RuleCode = ruleEntity.RuleCode,
RuleName = ruleEntity.RuleName,
RuleContent = ruleEntity.RuleContent,
});
}
}
}
catch (Exception ex)
{
ruleEntity.ErrorTip = "耕地监测图斑未变化逻辑性检测:" + ex.Message;
result.Add(ruleEntity);
}
return result;
}
public List<RuleEntity> JZ018()
{
List<RuleEntity> result = new List<RuleEntity>();
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "DTBDLTBGX",
ErrorId = this.TBBSM,
ErrorTip = "疑似新增建设用地图斑若实地不为建设用地或设施农用地,应存在实地举证照片",
ErrorType = "一类错误",
RuleCode = "JZ018",
RuleName = "疑似新增建设用地图斑举证情况检查",
RuleContent = "若任务图斑为监测图斑,且监测类型为“疑似新增建设用地监测图斑层”,若地类不为建设用地或设施农用地时,必须存在实地举证照片。否则,判定为错误图斑。"
};
try
{
DataTable dataTable = SQLiteDBOperate.Instance.ExceDataTable(this.SourcePath, $"select gx.BSM from DTBDLTBGX gx left join WYRW wy on gx.tbbsm=wy.tbbsm where gx.tbbsm='{TBBSM}' and JCDL='XZJS' and dlbm not in({DLParams.jsyd_dlbms},'1202') and dlbm not like '99%' and gx.ljlx NOT IN('两期影像一致','影像支持') and gx.bsm not in(select tbbsm from fjgx where wytbbsm='{TBBSM}')");
if (dataTable != null && dataTable.Rows.Count > 0)
{
foreach (DataRow item in dataTable.Rows)
{
ruleEntity.BGFWBSM = ruleEntity.ErrorId = item[0].ToString();
result.Add(new RuleEntity()
{
CheckObject = ruleEntity.CheckObject,
BGFWBSM = item["bsm"].ToString(),
ErrorId = ruleEntity.ErrorId,
ErrorTip = ruleEntity.ErrorTip,
ErrorType = ruleEntity.ErrorType,
RuleCode = ruleEntity.RuleCode,
RuleName = ruleEntity.RuleName,
RuleContent = ruleEntity.RuleContent,
});
}
}
}
catch (Exception ex)
{
ruleEntity.ErrorTip = "耕地监测图斑未变化逻辑性检测:" + ex.Message;
result.Add(ruleEntity);
}
return result;
}
public List<RuleEntity> JZ019()
{
List<RuleEntity> result = new List<RuleEntity>();
try
{
DataTable dataTable = CheckHelper.SQLiteDBOperate.Instance.ExceDataTable(this.SourcePath, $"select DISTINCT(t.bsm) from DTBDLTBGX t left join DTBDLTBGXGC t1 on t.bsm=t1.BGHTBBSM where t1.BGQDLBM<>'0101' and BGHDLBM='0101' and t.LJLX='水旱轮作' and t.TBBSM='{TBBSM}' and t.dlbm not like '99%'");
if (dataTable == null || dataTable.Rows.Count <= 0)
return result;
foreach (DataRow item in dataTable.Rows)
{
result.Add(new RuleEntity()
{
CheckObject = "DTBDLTBGX",
ErrorId = item["bsm"].ToString(),
BGFWBSM = item["bsm"].ToString(),
ErrorTip = "新增水田图斑不得标注水旱轮作。",
ErrorType = "一类错误",
RuleCode = "JZ019",
RuleName = "水旱轮作与地类逻辑性检查",
RuleContent = "对于DTBDLTBGXGC层中,变更前地类不为0101,变更后地类为0101的图斑,类举类型为“水旱轮作”时,认定为错误图斑。"
});
}
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "DTBDLTBGX",
ErrorId = this.TBBSM,
ErrorTip = "新增水田图斑不得标注水旱轮作。规则检查失败:" + ex.Message,
ErrorType = "一类错误",
RuleCode = "JZ019",
RuleName = "水旱轮作与地类逻辑性检查",
RuleContent = "对于DTBDLTBGXGC层中,变更前地类不为0101,变更后地类为0101的图斑,类举类型为“水旱轮作”时,认定为错误图斑。"
};
result.Add(ruleEntity);
}
return result;
}
public List<RuleEntity> JZ022()
{
List<RuleEntity> result = new List<RuleEntity>();
List<string> bsmList = new List<string>();
List<string> groupCode = new List<string>() { "YBZP", "TZZP", "CNZP", "WTZP" };
List<string> mode = new List<string>() { "7", "9" };
try
{
string sql = $@"select bsm from DTBDLTBGX where TBBSM='{TBBSM}'
AND LJLX in ('') AND DLBM NOT IN('9902','9903','9904')";
System.Data.DataTable dataTable = SQLiteDBOperate.Instance.ExceDataTable(this.SourcePath, sql);
if (dataTable != null && dataTable.Rows.Count > 0)
{
foreach (DataRow item in dataTable.Rows)
{
string bgfwBsm = item[0].ToString();
sql = $@"select f.TBBSM,GROUPCODE,MODE from FJGX f left join WYHCFJ w on f.FJARG=w.ARG where f.TBBSM='{bgfwBsm}' and hcjlbsm= '{TBBSM}'";
dataTable = SQLiteDBOperate.Instance.ExceDataTable(this.SourcePath, sql);
if (dataTable != null && dataTable.Rows.Count > 0)
{
var state = dataTable.AsEnumerable();
int notWrjzp = state.Count(x => (groupCode.Contains(x.Field<string>("GROUPCODE")) || string.IsNullOrEmpty(x.Field<string>("GROUPCODE"))) && !mode.Contains(x.Field<string>("MODE")));
int wrjzp = state.Count(x => groupCode.Contains(x.Field<string>("GROUPCODE")) && mode.Contains(x.Field<string>("MODE")));
if ((notWrjzp < 3 || notWrjzp > 30) && wrjzp == 0)
bsmList.Add(item[0].ToString());
else if (wrjzp < 2 && notWrjzp == 0)
bsmList.Add(item[0].ToString());
else if (notWrjzp >= 3 || wrjzp >= 2)
continue;
else
bsmList.Add(item[0].ToString());
}
else
bsmList.Add(bgfwBsm);
}
}
if (bsmList.Count > 0)
{
foreach (DataRow item in dataTable.Rows)
{
result.Add(new RuleEntity()
{
CheckObject = "外业举证照片",
ErrorId = item[0].ToString(),
BGFWBSM = item[0].ToString(),
ErrorTip = "承诺耕地类型的外业图斑,举证照片为无人机举证时总数不可少于2张,无人机以外的举证方式时,总数不可少于3张。",
ErrorType = "一类错误",
RuleCode = "JZ022",
RuleName = "承诺耕地照片挂接检查",
RuleContent = "若图斑“类举类型”标注为“承诺耕地”,举证照片中一般照片、承诺照片、特征照片总数少于3张或无人机照片少于两张时,判定为错误图斑。"
});
}
}
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "外业举证照片",
ErrorId = this.TBBSM,
ErrorTip = "承诺耕地类型的外业图斑,举证照片为无人机举证时总数不可少于2张,无人机以外的举证方式时,总数不可少于3张。规则检查失败:" + ex.Message,
ErrorType = "一类错误",
RuleCode = "JZ022",
RuleName = "承诺耕地照片挂接检查",
RuleContent = "若图斑“类举类型”标注为“承诺耕地”,举证照片中一般照片、承诺照片、特征照片总数少于3张或无人机照片少于两张时,判定为错误图斑。"
};
result.Add(ruleEntity);
}
return result;
}
public List<RuleEntity> JZ023()
{
List<RuleEntity> result = new List<RuleEntity>();
try
{
string sql = $@"select bsm,ZZSXDM,dlbm from DTBDLTBGX where ljlx='承诺耕地' and DDTCBZ='一般地类' and TBBSM='{TBBSM}' and dlbm not like '99%'";
System.Data.DataTable dataTable = SQLiteDBOperate.Instance.ExceDataTable(this.SourcePath, sql);
if (dataTable != null && dataTable.Rows.Count > 0)
{
foreach (DataRow item in dataTable.Rows)
{
if (item["dlbm"].ToString().StartsWith("01") && item["zzsxdm"].ToString().Equals("WG", StringComparison.CurrentCultureIgnoreCase))
{
result.Add(new RuleEntity()
{
CheckObject = "DTBDLTBGX层",
ErrorId = item["bsm"].ToString(),
BGFWBSM = item["bsm"].ToString(),
ErrorTip = "承诺耕地不可为未耕种耕地,也不可为单独图层下耕地。",
ErrorType = "一类错误",
RuleCode = "JZ023",
RuleName = "承诺耕地地类逻辑一致性检查",
RuleContent = "若图斑“类举类型”标注为“承诺耕地”,地类编码需为01类,种植属性代码不可为WG,单独图层代码需为空。否则,认定为错误图斑。"
});
}
}
}
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "DTBDLTBGX层",
ErrorId = this.TBBSM,
ErrorTip = "承诺耕地不可为未耕种耕地,也不可为单独图层下耕地。规则检查失败:" + ex.Message,
ErrorType = "一类错误",
RuleCode = "JZ023",
RuleName = "承诺耕地地类逻辑一致性检查",
RuleContent = "若图斑“类举类型”标注为“承诺耕地”,地类编码需为01类,种植属性代码不可为WG,单独图层代码需为空。否则,认定为错误图斑。"
};
result.Add(ruleEntity);
}
return result;
}
public List<RuleEntity> JZ024()
{
List<RuleEntity> result = new List<RuleEntity>();
try
{
DataTable dataTable = CheckHelper.SQLiteDBOperate.Instance.ExceDataTable(this.SourcePath, $"select DISTINCT(t.BSM) from DTBDLTBGX t left join DTBDLTBGXGC t1 on t.bsm=t1.BGHTBBSM where t.TBBSM='{TBBSM}' and t.dlbm not like '99%' and ljlx='承诺耕地' and ((BGQDLBM not in({DLParams.gd_dlbms},{DLParams.yd_dlbms},{DLParams.ld_dlbms},'0401','0402','0403','0403K','1006','1103','1104','1104K','1104A','1107','1107A','1202','1203') and t.TBMJ>200) or (BGQDLBM not in('0401','0402','0403','0403K','1006','1103','1104','1104K','1104A','1107','1107A','1202','1203') and BGQDLBM in({DLParams.gd_dlbms}) and t1.TBBGMJ / t.TBMJ > 0.95))");
if (dataTable == null || dataTable.Rows.Count <= 0)
return result;
foreach (DataRow item in dataTable.Rows)
{
result.Add(new RuleEntity()
{
CheckObject = "DTBDLTBGXGC层",
ErrorId = item["bsm"].ToString(),
BGFWBSM = item["bsm"].ToString(),
ErrorTip = "承诺耕地图斑变更前地类必须为除耕地外的其他农用地",
ErrorType = "一类错误",
RuleCode = "JZ024",
RuleName = "承诺耕地变更前地类逻辑一致性检查",
RuleContent = "若图斑“类举类型”标注为“承诺耕地”,在相应DTBDLTBGXGC层中,变更前地类需位于02-03、0401-0403、1006、1103-1104、1107、1202-1203之间。若存在不在此地类编码中的部分大于200平方米,认定为错误图斑。"
});
}
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "DTBDLTBGXGC层",
ErrorId = this.TBBSM,
ErrorTip = "承诺耕地图斑变更前地类必须为除耕地外的其他农用地。规则检查失败:" + ex.Message,
ErrorType = "一类错误",
RuleCode = "JZ024",
RuleName = "承诺耕地变更前地类逻辑一致性检查",
RuleContent = "若图斑“类举类型”标注为“承诺耕地”,在相应DTBDLTBGXGC层中,变更前地类需位于02-03、0401-0403、1006、1103-1104、1107、1202-1203之间。若存在不在此地类编码中的部分大于200平方米,认定为错误图斑。"
};
result.Add(ruleEntity);
}
return result;
}
public List<RuleEntity> JZ025()
{
List<RuleEntity> result = new List<RuleEntity>();
try
{
DataTable dataTable = CheckHelper.SQLiteDBOperate.Instance.ExceDataTable(this.SourcePath, $"select DISTINCT(t.bsm) from DTBDLTBGX t left join DTBDLTBGXGC t1 on t.BSM=t1.BGHTBBSM where t.TBBSM = '{TBBSM}' and t.dlbm not like '99%' and t.ZZSXDM = 'GCHF' AND t1.BGQDLBM = t1.BGHDLBM and t1.BGQZZSXDM = 'JKHF' AND (T1.TBBGMJ > 200 OR T1.TBBGMJ / t.TBMJ > 0.5) and t.bsm not in (select f.TBBSM from fjgx f where f.WYTBBSM = '{TBBSM}')");
if (dataTable == null || dataTable.Rows.Count <= 0)
return result;
foreach (DataRow item in dataTable.Rows)
{
result.Add(new RuleEntity()
{
CheckObject = "DTBDLTBGXGC层",
ErrorId = item["bsm"].ToString(),
BGFWBSM = item["bsm"].ToString(),
ErrorTip = "地类未发生变化,种植属性变化的图斑,必须实地举证",
ErrorType = "一类错误",
RuleCode = "JZ025",
RuleName = "恢复属性变更照片逻辑性检查",
RuleContent = "对于“种植属性代码”为GCHF的图斑,若相应DTBDLTBGXGC层中,存在变更前地类编码和变更后地类编码相一致、变更前种植属性代码为JKHF的部分,并且该部分面积达到200平方米或占DTBDLTBGX层的面积比例达到50%以上,若图斑不存在实地举证照片,认定为错误图斑。"
});
}
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "DTBDLTBGXGC层",
ErrorId = this.TBBSM,
ErrorTip = "地类未发生变化,种植属性变化的图斑,必须实地举证。规则检查失败:" + ex.Message,
ErrorType = "一类错误",
RuleCode = "JZ025",
RuleName = "恢复属性变更照片逻辑性检查",
RuleContent = "对于“种植属性代码”为GCHF的图斑,若相应DTBDLTBGXGC层中,存在变更前地类编码和变更后地类编码相一致、变更前种植属性代码为JKHF的部分,并且该部分面积达到200平方米或占DTBDLTBGX层的面积比例达到50%以上,若图斑不存在实地举证照片,认定为错误图斑。"
};
result.Add(ruleEntity);
}
return result;
}
public List<RuleEntity> JZ026()
{
List<RuleEntity> result = new List<RuleEntity>();
return result;
try
{
DataTable dataTable = CheckHelper.SQLiteDBOperate.Instance.ExceDataTable(this.SourcePath, $"select DISTINCT(t.bsm) from DTBDLTBGX t left join DTBDLTBGXGC t1 on t.BSM=t1.BGHTBBSM where t.TBBSM = '{TBBSM}' and t.dlbm not like '99%' and t.TBMJ>400 AND t1.BGQDLBM IN({DLParams.gd_dlbms}) AND BGHDLBM IN({DLParams.yd_dlbms},{DLParams.ld_dlbms},'0401','0402','0403','1104','1104A','1202') AND (T1.TBBGMJ >= 200 OR T1.TBBGMJ / t.TBMJ > 0.3) and t.tbmj > 400 and t.bsm not in (select f.TBBSM from fjgx f where f.WYTBBSM = '{TBBSM}')");
if (dataTable == null || dataTable.Rows.Count <= 0)
return result;
foreach (DataRow item in dataTable.Rows)
{
result.Add(new RuleEntity()
{
CheckObject = "DTBDLTBGXGC层",
ErrorId = item["bsm"].ToString(),
BGFWBSM = item["bsm"].ToString(),
ErrorTip = "耕地变更为其他农用地图斑必须存在实地证照片",
ErrorType = "一类错误",
RuleCode = "JZ026",
RuleName = "耕地流出情况与举证照片逻辑性检查",
RuleContent = "对于DTBDLTBGXGC层中,变更前地类为耕地(01类)、变更后地类编码为02类、03类、0401-0403、1104、1104A、1104K、1202的,当面积大于等于200平方米,或占DTBDLTBGX层图斑面积超过30%时,若相应DTBDLTBGX层图斑“不存在实地举证照片,认定为错误图斑。"
});
}
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "DTBDLTBGXGC层",
ErrorId = this.TBBSM,
ErrorTip = "耕地变更为其他农用地图斑必须存在实地证照片。规则检查失败:" + ex.Message,
ErrorType = "一类错误",
RuleCode = "JZ026",
RuleName = "耕地流出情况与举证照片逻辑性检查",
RuleContent = "对于DTBDLTBGXGC层中,变更前地类为耕地(01类)、变更后地类编码为02类、03类、0401-0403、1104、1104A、1104K、1202的,当面积大于等于200平方米,或占DTBDLTBGX层图斑面积超过30%时,若相应DTBDLTBGX层图斑“不存在实地举证照片,认定为错误图斑。"
};
result.Add(ruleEntity);
}
return result;
}
public List<RuleEntity> JZ027()
{
List<RuleEntity> result = new List<RuleEntity>();
try
{
DataTable dataTable = CheckHelper.SQLiteDBOperate.Instance.ExceDataTable(this.SourcePath, $"select DISTINCT(t.bsm) from DTBDLTBGX t left join DTBDLTBGXGC t1 on t.BSM=t1.BGHTBBSM where t.TBBSM = '{TBBSM}'and t.dlbm not like '99%' AND t1.BGQDLBM IN({DLParams.nyd_dlbms},{DLParams.yd_dlbms},{DLParams.ld_dlbms},'0401','0402','0403','1103','1104','1107','1202','1203') AND BGHDLBM IN('0404','0404A','1101','1102','1105','1106','1108','1204','1205','1206','1207') AND (T1.TBBGMJ >= 400 OR T1.TBBGMJ / t.TBMJ > 0.3) and (t.ljlx<>'农变未' or t.bsm not in (select f.TBBSM from fjgx f where f.WYTBBSM = '{TBBSM}'))");
if (dataTable == null || dataTable.Rows.Count <= 0)
return result;
foreach (DataRow item in dataTable.Rows)
{
result.Add(new RuleEntity()
{
CheckObject = "DTBDLTBGXGC层",
ErrorId = item["bsm"].ToString(),
BGFWBSM = item["bsm"].ToString(),
ErrorTip = "非耕农用地变未利用地图斑必须标注“农变未”且存在实地举证照片",
ErrorType = "一类错误",
RuleCode = "JZ027",
RuleName = "耕地流出情况与举证照片逻辑性检查",
RuleContent = "对于DTBDLTBGXGC层中,变更前地类为耕地(01类)、变更后地类编码为02类、03类、0401-0403、1104、1104A、1202的,当面积大于等于400平方米,或占DTBDLTBGX层图斑面积超过30%时,若相应DTBDLTBGX层图斑“不存在实地举证照片,认定为错误图斑。"
});
}
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "DTBDLTBGXGC层",
ErrorId = this.TBBSM,
ErrorTip = "非耕农用地变未利用地图斑必须标注“农变未”且存在实地举证照片。规则检查失败:" + ex.Message,
ErrorType = "一类错误",
RuleCode = "JZ027",
RuleName = "耕地流出情况与举证照片逻辑性检查",
RuleContent = "对于DTBDLTBGXGC层中,变更前地类为耕地(01类)、变更后地类编码为02类、03类、0401-0403、1104、1104A、1202的,当面积大于等于400平方米,或占DTBDLTBGX层图斑面积超过30%时,若相应DTBDLTBGX层图斑“不存在实地举证照片,认定为错误图斑。"
};
result.Add(ruleEntity);
}
return result;
}
public List<RuleEntity> JZ028()
{
List<RuleEntity> result = new List<RuleEntity>();
return result;
try
{
DataTable dataTable = CheckHelper.SQLiteDBOperate.Instance.ExceDataTable(this.SourcePath, $"select DISTINCT(t.bsm) from DTBDLTBGX t left join DTBDLTBGXGC t1 on t.BSM=t1.BGHTBBSM where t.TBBSM = '{TBBSM}' and t.dlbm not like '99%' AND t1.BGQDLBM<>t1.BGHDLBM AND t1.BGQDLBM IN({DLParams.yd_dlbms},{DLParams.ld_dlbms},'0401','0402','0403') AND BGHDLBM IN({DLParams.yd_dlbms},{DLParams.ld_dlbms},'0401','0402','0403') AND (T1.TBBGMJ >= 200 OR T1.TBBGMJ / t.TBMJ > 0.3) and t.bsm not in (select f.TBBSM from fjgx f where f.WYTBBSM = '{TBBSM}')");
if (dataTable == null || dataTable.Rows.Count <= 0)
return result;
foreach (DataRow item in dataTable.Rows)
{
result.Add(new RuleEntity()
{
CheckObject = "DTBDLTBGXGC层",
ErrorId = item["bsm"].ToString(),
BGFWBSM = item["bsm"].ToString(),
ErrorTip = "园地、林地、草地间变化图斑必须存在实地证照片",
ErrorType = "一类错误",
RuleCode = "JZ028",
RuleName = "非耕农用地内部变化与举证照片逻辑性检查",
RuleContent = "对于DTBDLTBGXGC层中,变更前地类与变更后地类不一致,变更前为耕地为02类、03类、0401-0403,变更后地类编码为02类、03类、0401-0403的,当面积大于等于200平方米,或占DTBDLTBGX层图斑面积超过30%时,若相应DTBDLTBGX层图斑“不存在实地举证照片,认定为错误图斑。"
});
}
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "DTBDLTBGXGC层",
ErrorId = this.TBBSM,
ErrorTip = "园地、林地、草地间变化图斑必须存在实地证照片。规则检查失败:" + ex.Message,
ErrorType = "一类错误",
RuleCode = "JZ028",
RuleName = "非耕农用地内部变化与举证照片逻辑性检查",
RuleContent = "对于DTBDLTBGXGC层中,变更前地类与变更后地类不一致,变更前为耕地为02类、03类、0401-0403,变更后地类编码为02类、03类、0401-0403的,当面积大于等于200平方米,或占DTBDLTBGX层图斑面积超过30%时,若相应DTBDLTBGX层图斑“不存在实地举证照片,认定为错误图斑。"
};
result.Add(ruleEntity);
}
return result;
}
public List<RuleEntity> JZ029()
{
List<RuleEntity> result = new List<RuleEntity>();
IFeatureClass jc_CngdFeatureClass = null;
IGeometry dltbGXgeo = null;
IFeatureCursor pCursor = null;
IFeature feature = null;
try
{
DataTable dataTable = CheckHelper.SQLiteDBOperate.Instance.ExceDataTable(this.SourcePath, $"select * from dtbdltbgx where tbbsm='{TBBSM}'");
if (dataTable == null || dataTable.Rows.Count <= 0)
return result;
if (!DicFeatureClass.ContainsKey("JC_CNGD") || DicFeatureClass["JC_CNGD"] == null)
return result;
//{
// throw new Exception("未找到“基础_地类图斑”参考图层!");
//}
jc_CngdFeatureClass = DicFeatureClass["JC_CNGD"];
ISpatialFilter spatialFilter = new SpatialFilterClass
{
SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects
};
ISpatialReference spatialReference = (jc_CngdFeatureClass as IGeoDataset).SpatialReference;
//Console.WriteLine(spatialReference.Name);
if (spatialReference == null)
throw new Exception("基础_承诺耕地图层坐标参考为空,质检失败!");
foreach (DataRow item in dataTable.Rows)
{
string ljlx = item["ljlx"].ToString();
string dlbm = item["dlbm"].ToString();
dltbGXgeo = CheckHelper.GeometryConvertHelper.ConverJsonToIGeoemtry(item["egeometry"].ToString(), esriGeometryType.esriGeometryPolygon);
dltbGXgeo.Project(spatialReference);
IArea geoArea = dltbGXgeo as IArea;
double area = geoArea.Area;
spatialFilter.Geometry = dltbGXgeo;
spatialFilter.WhereClause = null;
pCursor = jc_CngdFeatureClass.Search(spatialFilter, true);
ITopologicalOperator topological = null;
while ((feature = pCursor.NextFeature()) != null)
{
if (topological == null)
{
topological = feature.ShapeCopy as ITopologicalOperator;
}
else
{
topological = topological.Union(feature.ShapeCopy) as ITopologicalOperator;
}
}
IGeometry GGeometry = null;
double GArea = 0;
IGeometry EGeometry = topological as IGeometry;
if (EGeometry != null && !EGeometry.IsEmpty)
{
topological = EGeometry as ITopologicalOperator;
if (EGeometry.SpatialReference == null)
{
EGeometry.SpatialReference = spatialReference;
}
GGeometry = CommonHelper.InterSect(dltbGXgeo, EGeometry);
GArea = (GGeometry as IArea).Area;
}
if (GArea / area < 0.98 && ljlx == "承诺耕地")
{
result.Add(new RuleEntity()
{
CheckObject = "DTBDLTBGX",
ErrorId = item["bsm"].ToString(),
BGFWBSM = item["bsm"].ToString(),
ErrorTip = "整改阶段标注承诺耕地的图斑必须位于“一上”承诺耕地图斑范围内。",
ErrorType = "一类错误",
RuleCode = "JZ029",
RuleName = "整改阶段承诺耕地标注信息正确性检查",
RuleContent = "若图斑“类举类型”标注为“承诺耕地”,将其与承诺耕地图层(融合处理后)进行叠加,若重叠部分占DTBDLTBGX层的比例小于98%,认定为错误图斑。"
});
}
if (GArea > 10 && !dlbm.StartsWith("01"))
{
result.Add(new RuleEntity()
{
CheckObject = "DTBDLTBGX",
ErrorId = item["bsm"].ToString(),
BGFWBSM = item["bsm"].ToString(),
ErrorTip = "“一上”承诺耕地图斑范围内的图斑须为耕地。",
ErrorType = "一类错误",
RuleCode = "CNGD001",
RuleName = "整改阶段承诺耕地范围地类正确性检查",
RuleContent = "提取DTBDLTBGX层图斑,将其与承诺耕地图层(融合处理后)进行叠加,对于重叠面积大于10平的图斑图斑,若地类编码不为01类,认定为错误图斑。"
});
}
}
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "DTBDLTBGX",
ErrorId = this.TBBSM,
ErrorTip = "整改阶段标注承诺耕地的图斑必须位于“一上”承诺耕地图斑范围内。规则检查失败:" + ex.Message,
ErrorType = "一类错误",
RuleCode = "JZ029",
RuleName = "整改阶段承诺耕地标注信息正确性检查",
RuleContent = "若图斑“类举类型”标注为“承诺耕地”,将其与承诺耕地图层(融合处理后)进行叠加,若重叠部分占DTBDLTBGX层的比例小于98%,认定为错误图斑。"
};
result.Add(ruleEntity);
}
return result;
}
public List<RuleEntity> JZ030()
{
List<RuleEntity> result = new List<RuleEntity>();
try
{
DataTable dataTable = CheckHelper.SQLiteDBOperate.Instance.ExceDataTable(this.SourcePath, $"select bsm from DTBDLTBGX where ljlx='承诺举证' and dlbm like '01%' and tbbsm='{this.TBBSM}' ");
if (dataTable == null || dataTable.Rows.Count <= 0)
return result;
foreach (DataRow item in dataTable.Rows)
{
result.Add(new RuleEntity()
{
CheckObject = "DTBDLTBGX层",
ErrorId = item["bsm"].ToString(),
BGFWBSM = item["bsm"].ToString(),
ErrorTip = "耕地图斑,类举类型不得标注“承诺举证”",
ErrorType = "一类错误",
RuleCode = "JZ030",
RuleName = "地类编码与承诺举证标记逻辑性检查",
RuleContent = "对于DTBDLTBGXGC层中,类举类型为“承诺举证”时,地类编码为01类时,认定为错误图斑。"
});
}
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "DTBDLTBGX层",
ErrorId = this.TBBSM,
ErrorTip = "耕地图斑,类举类型不得标注“承诺举证”。规则检查失败:" + ex.Message,
ErrorType = "一类错误",
RuleCode = "JZ030",
RuleName = "地类编码与承诺举证标记逻辑性检查",
RuleContent = "对于DTBDLTBGXGC层中,类举类型为“承诺举证”时,地类编码为01类时,认定为错误图斑。"
};
result.Add(ruleEntity);
}
return result;
}
}
}