using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ESRI.ArcGIS.Geodatabase;
using Kingo.RuleCheck.CheckHelper;
namespace Kingo.RuleCheck.XJRuleCheck
{
///
/// 地类属性与举证照片逻辑性检查
///
public class DLSXYJZZPCheck_DTB : RuleCheckBase_DTB
{
List ruleMethodNames = new List() {
"JZ001","JZ002","JZ003","JZ004","JZ005","JZ007","JZ008","JZ009","JZ010","JZ011","JZ012","JZ013","WYZP011","BCSM001","BCSM002","JZ014","JZ041","SM201","JZ020","WYZP012","FJ001"
};
public override List ExcuteCheck(string sourePath, IWorkspace workspace)
{
return this.StartCheck(sourePath, workspace, ruleMethodNames);
}
public override List ExcuteCheck(IWorkspace workspace, List layerNames, List dataSetNames)
{
return this.StartCheck(workspace, ruleMethodNames, layerNames, dataSetNames);
}
public override List ExcuteCheck(string sourePath, Dictionary workspace)
{
return this.StartCheck(sourePath, workspace, ruleMethodNames);
}
public override List ExcuteCheck(string tbbsm, string sourePath, Dictionary workspace)
{
return this.StartCheck(tbbsm, sourePath, workspace, ruleMethodNames);
}
public List JZ001()
{
List result = new List();
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 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)");
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 JZ002()
{
List result = new List();
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 JZ003()
{
List result = new List();
//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 JZ004()
{
List result = new List();
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='农变未'))";
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 JZ005()
{
List result = new List();
try
{
var sql = $"SELECT BSM FROM DTBDLTBGX WHERE TBBSM='{TBBSM}' 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 JZ006()
//{
// List result = new List();
// 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 JZ007()
{
List result = new List();
try
{
DataTable dataTable = SQLiteDBOperate.Instance.ExceDataTable(this.SourcePath, $"SELECT BSM FROM DTBDLTBGX WHERE TBBSM='{TBBSM}' 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 JZ008()
{
List result = new List();
try
{
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层图斑相对于基础库变化部分的面积占图斑面积的比例在10%及以上时,若“是否更新”字段值不为相应“地类编码”,认定为错误图斑。"
};
result.Add(ruleEntity);
}
return result;
}
public List JZ009()
{
List result = new List();
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<>'否'";
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 JZ010()
{
List result = new List();
try
{
var sql = $"select gx.bsm from DTBDLTBGX gx where gx.TBBSM='{TBBSM}' 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 JZ011()
//{
// List result = new List();
// 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 JZ012()
{
List result = new List();
try
{
string sql = $"SELECT BSM FROM DTBDLTBGX WHERE TBBSM='{TBBSM}' 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 JZ013()
{
List result = new List();
try
{
DataTable dataTable = SQLiteDBOperate.Instance.ExceDataTable(this.SourcePath, $"SELECT BSM FROM DTBDLTBGX WHERE TBBSM='{TBBSM}' and SFGX='否' AND (WBGYY IS NULL OR length(replace(WBGYY,' ',''))<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 = "未变化图斑必须填写未更新原因,且内容长度不可小于5",
ErrorType = "一类错误",
RuleCode = "JZ013",
RuleName = "未变化图斑逻辑性检查",
RuleContent = "若图斑字段“是否更新”列为“否”,“未更新原因”字段为空或长度小于5,判定为错误图斑。"
});
}
}
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "DTBDLTBGX",
ErrorId = this.TBBSM,
ErrorTip = "未变化图斑必须填写未更新原因规则检查失败:" + ex.Message,
ErrorType = "一类错误",
RuleCode = "JZ013",
RuleName = "未变化图斑逻辑性检查",
RuleContent = "若图斑字段“是否更新”列为“否”,“未更新原因”字段为空或长度小于5,判定为错误图斑。"
};
result.Add(ruleEntity);
}
return result;
}
public List WYZP011()
{
List result = new List();
try
{
string sql = $@"select bsm from DTBDLTBGX where TBBSM='{TBBSM}'
AND LJLX in ('', '农变未', '水旱轮作')
AND(BSM not in (select TBBSM from FJGX where WYTBBSM = '{TBBSM}'))
OR LJLX in ('', '农变未', '水旱轮作') AND BSM in (select tbbsm FROM FJGX gx left join(select arg, GROUPCODE, mode from WYHCFJ
where hcjlbsm= '{TBBSM}') fj on gx.FJARG = fj.ARG where WYTBBSM = '{TBBSM}' group by tbbsm
HAVING (count(GROUPCODE in ('YBZP', 'TZZP', 'CNZP') or GROUPCODE IS NULL)< 3) AND (count(mode in ('7','9') or mode IS NULL)< 2)
)";
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 = "外业举证照片",
ErrorId = item[0].ToString(),
BGFWBSM = item[0].ToString(),
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 BCSM001()
{
List result = new List();
try
{
string sql = $"select bsm from DTBDLTBGX where TBBSM='{TBBSM}' 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 BCSM002()
{
List result = new List();
try
{
string sql = $"select bsm from DTBDLTBGX where TBBSM='{TBBSM}' 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 JZ014()
{
List result = new List();
try
{
DataTable dataTable = SQLiteDBOperate.Instance.ExceDataTable(this.SourcePath, $"select BGHTBBSM from DTBDLTBGXGC where TBBSM='{TBBSM}' AND BGQDLBM IN ('0101') and BGQZZSXDM in ('LS') and bghdlbm in ('0101') and BGHZZSXDM in ('FLS') 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='水旱轮作'))");
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层中,变更前地类为水田、种植属性为LS的,变更后地类为水田,种植属性为FLS,当面积大于等于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;
}
///
/// 农用地变未利用地图斑与举证照片逻辑性检查
///
///
public List JZ041()
{
List result = new List();
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 (b.BGQDLBM not IN ({DLParams.nyd_dlbms}) or b.bghdlbm not in({DLParams.wlyd_dlbms}))";
sql = $"select bsm from dtbdltbgx where tbbsm ='{TBBSM}' 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 SM201()
{
List result = new List();
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 JZ020()
{
List result = new List();
try
{
DataTable dataTable = SQLiteDBOperate.Instance.ExceDataTable(this.SourcePath, $"select bsm from DTBDLTBGX WHERE TBBSM='{TBBSM}' 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 WYZP012()
{
List result = new List();
string strInfo = string.Empty;
try
{
string sql = $"select c.bsm,c.tbmj,sum(case when mode in ('5') then 1 else 0 end) as videocount,sum(case when mode not in ('4','5') then 1 else 0 end) as imagecount from wyhcfj a inner join fjgx b on a.hcjlbsm=b.wytbbsm and b.fjarg = a.arg inner join dtbdltbgx c on c.tbbsm = b.wytbbsm and c.bsm=b.tbbsm where HCJLBSM='{TBBSM}' and (UserDelete <> 1 or UserDelete is not null) group by c.bsm,c.tbmj";
DataTable dt = CheckHelper.SQLiteDBOperate.Instance.ExceDataTable(this.SourcePath, sql);
if (dt == null || dt.Rows.Count <= 0)
{
return null;
}
foreach (DataRow item in dt.Rows)
{
strInfo = string.Empty;
int imageCount = 0, videoCount = 0;
double tbmj = 0;
if (item["imagecount"] != null && !string.IsNullOrEmpty(item["imagecount"].ToString()))
{
imageCount = int.Parse(item["imagecount"].ToString());
}
if (item["videocount"] != null && !string.IsNullOrEmpty(item["videocount"].ToString()))
{
videoCount = int.Parse(item["videocount"].ToString());
}
if (item["tbmj"] != null && !string.IsNullOrEmpty(item["tbmj"].ToString()))
{
tbmj = double.Parse(item["tbmj"].ToString()) * 0.0015;
}
if (tbmj <= 5)
{
if (imageCount > 15 || videoCount > 2)
{
strInfo = "图斑面积小于5亩时,外业照片数量超过15张,或者外业视频数量超过2段";
}
}
else if (5 < tbmj && tbmj <= 20)
{
if (imageCount > 30 || videoCount > 5)
{
strInfo = "图斑面积大于5亩小于等于20亩时,外业照片数量超过30张,或者外业视频数量超过5段";
}
}
else
{
if (imageCount > 50 || videoCount > 7)
{
strInfo = "图斑面积大于20亩时,外业照片数量超过50张,或者外业视频数量超过7段";
}
}
if(!string.IsNullOrEmpty(strInfo))
{
result.Add(new RuleEntity()
{
CheckObject = "DTBDLTBGX",
ErrorId = $"{item["BSM"].ToString()}",
BGFWBSM = $"{item["BSM"].ToString()}",
ErrorTip = strInfo,
ErrorType = "一类错误",
RuleCode = "WYZP012",
RuleName = "图斑外业照片、视频数量检查",
RuleContent = strInfo
});
}
}
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "DTBDLTBGX",
ErrorId = this.TBBSM,
ErrorTip = "WYZP012规则执行失败:" + ex.Message,
ErrorType = "一类错误",
RuleCode = "WYZP012",
RuleName = "图斑外业照片、视频数量检查",
RuleContent = strInfo
};
result.Add(ruleEntity);
}
return result.Count > 0 ? result : null;
}
///
/// 新增耕地必须上传附件,校验FJGX表是否有选择的附件
///
///
public List FJ001()
{
List result = new List();
try
{
DataTable dataTable = SQLiteDBOperate.Instance.ExceDataTable(this.SourcePath, $"select bsm from DTBDLTBGX WHERE TBBSM='{TBBSM}' and SFXML = '1'");
if (dataTable != null && dataTable.Rows.Count == 0)
{
return null;
}
dataTable = SQLiteDBOperate.Instance.ExceDataTable(this.SourcePath, $"select fjarg from fjgx a inner join wyhcfj b on a.wytbbsm = b.hcjlbsm and a.fjarg = b.arg and MODE = '4' inner join dtbdltbgx c on c.tbbsm = a.wytbbsm and c.bsm = a.tbbsm where c.tbbsm ='{TBBSM}' and c.sfxml = '1'");
if (dataTable != null && dataTable.Rows.Count == 0)
{
result.Add(new RuleEntity()
{
CheckObject = "DTBDLTBGX",
ErrorId = this.TBBSM,
BGFWBSM = this.TBBSM,
ErrorTip = "新增耕地必须上传附件",
ErrorType = "一类错误",
RuleCode = "FJ001",
RuleName = "新增耕地附件检查",
RuleContent = "新增耕地必须上传附件。"
});
}
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
CheckObject = "DTBDLTBGX",
ErrorId = this.TBBSM,
BGFWBSM = this.TBBSM,
ErrorTip = "新增耕地必须上传附件",
ErrorType = "一类错误",
RuleCode = "FJ001",
RuleName = "新增耕地附件检查",
RuleContent = "新增耕地必须上传附件。"
};
result.Add(ruleEntity);
}
return result;
}
}
}