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.
118 lines
4.7 KiB
118 lines
4.7 KiB
using ESRI.ArcGIS.Geodatabase; |
|
using KGIS.Framework.DBOperator; |
|
using KGIS.Framework.Maps; |
|
using KGIS.Framework.Platform; |
|
using KGIS.Framework.Utils; |
|
using KGIS.Framework.Utils.ExtensionMethod; |
|
using KGIS.Framework.Utils.Helper; |
|
using Kingo.PluginServiceInterface; |
|
using System; |
|
using System.Collections.Generic; |
|
using System.Data; |
|
|
|
namespace Kingo.Plugin.DataCheck.Helper.JCBGCG |
|
{ |
|
public class BGCGAttribureCheck : DataCheckRule |
|
{ |
|
private string _RuleName; |
|
public override string RuleName { get => _RuleName; set => _RuleName = value; } |
|
private string _RuleDesc; |
|
public override string RuleDesc { get => _RuleDesc; set => _RuleDesc = value; } |
|
|
|
public List<IDataCheck> IdataChecks { get; set; } |
|
public BGCGAttribureCheck(string pGropuCode) : base() |
|
{ |
|
_RuleName = "变更成果逻辑检查"; |
|
_RuleDesc = "变更成果属性逻辑一致性检查、属性完整性"; |
|
} |
|
|
|
public override void StartCheck(object pParm) |
|
{ |
|
try |
|
{ |
|
base.CheckState = EnumCheckState.检查中; |
|
IFeatureClass GX = MapsManager.Instance.MapService.GetFeatureClassByName("DLTBGX"); |
|
IFeatureClass GXGC = MapsManager.Instance.MapService.GetFeatureClassByName("DLTBGXGC"); |
|
if (GX == null || GXGC == null) |
|
{ |
|
base.CheckState = EnumCheckState.检查失败; |
|
MessageHelper.Show("未找到地类图斑更新图层/地类图斑更新过程层,请检查图层是否存在!"); |
|
return; |
|
} |
|
IDataCheckHelper dataCheckHelper = UIShell.OSGi.BundleRuntime.Instance.GetFirstOrDefaultService<IDataCheckHelper>(); |
|
if (dataCheckHelper == null) |
|
{ |
|
base.CheckState = EnumCheckState.检查失败; |
|
return; |
|
} |
|
dataCheckHelper.DataCheck(new CheckParametr() |
|
{ |
|
CheckType = enumCheckType.Attribute, |
|
DataSource = GX, |
|
IDataCheckName = "BGHDataCheck" |
|
}); |
|
StartLoadData(pParm); |
|
base.CheckState = EnumCheckState.检查完成; |
|
} |
|
catch (Exception ex) |
|
{ |
|
base.CheckState = EnumCheckState.检查失败; |
|
LogAPI.Debug(string.Format("{0}", _RuleName)); |
|
LogAPI.Debug(ex); |
|
} |
|
} |
|
|
|
public override void StartLoadData(object pParm) |
|
{ |
|
try |
|
{ |
|
string dbPath = System.IO.Path.Combine((MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).ProjDir, "DataCheckrResult.db"); |
|
DataTable dt = SQLiteDBOperate.Instance.ExceDataTable(dbPath, "select * from DataCheckResults WHERE ErrorLayer='BGHDataCheck' order by ErrorType DESC"); |
|
if (dt == null) return; |
|
//base.CheckResults.Clear(); |
|
for (int i = 0; i < dt.Rows.Count; i++) |
|
{ |
|
int id = dt.Rows[i]["ID"].ToInt(); |
|
int bgoid = dt.Rows[i]["OBJECTID"].ToInt(); |
|
string jcError = dt.Rows[i]["ErrorDesc"].ToTrim(); |
|
string jcErrorType = dt.Rows[i]["ErrorType"].ToTrim(); |
|
string jcErrorCode = dt.Rows[i]["ErrorCode"].ToTrim(); |
|
string jcErrorArea = dt.Rows[i]["ErrorArea"].ToTrim(); |
|
string jcErrorLayer = dt.Rows[i]["ErrorLayer"].ToTrim(); |
|
EnumErrorType errType = (EnumErrorType)Enum.Parse(typeof(EnumErrorType), jcErrorType); |
|
base.CheckResults.Add(new DataCheckResult() |
|
{ |
|
ID = id, |
|
ErrorDesc = jcError, |
|
ErrorCode = jcErrorCode, |
|
ErrorLayer = jcErrorLayer, |
|
PrimaryKey = "OBJECTID", |
|
PrimaryKeyValue = dt.Rows[i]["OBJECTID"].ToTrim(), |
|
ErrorType = errType, |
|
ErrorArea = jcErrorArea, |
|
Icon = string.Format("pack://siteoforigin:,,,/Images/{0}.{1}", errType.ToString(), "png") |
|
}); |
|
} |
|
} |
|
catch (Exception ex) |
|
{ |
|
MessageHelper.ShowError("加载检查结果视图数据失败,请查看日志!"); |
|
LogAPI.Debug(ex.Message); |
|
} |
|
} |
|
public override void StartRepair(object pParm) |
|
{ |
|
|
|
} |
|
|
|
public override void StartSingleRepair(object pParm) |
|
{ |
|
|
|
} |
|
|
|
public override void StartCheckForThread(object pParam) |
|
{ |
|
|
|
} |
|
} |
|
}
|
|
|