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.
210 lines
7.5 KiB
210 lines
7.5 KiB
using KGIS.Framework.Maps; |
|
using KGIS.Framework.Platform.Helper; |
|
using KGIS.Framework.Utils; |
|
using KGIS.Framework.Utils.Helper; |
|
using Kingo.Plugin.YJJK.Helper; |
|
using Kingo.PluginServiceInterface; |
|
using Kingo.PluginServiceInterface.Model; |
|
using KUI.Windows; |
|
using System; |
|
using System.Collections.Generic; |
|
using System.Linq; |
|
using System.Windows; |
|
using System.Windows.Controls; |
|
using System.Xml.Linq; |
|
using GDEntity = Kingo.Plugin.YJJK.Helper.SXWHHelper.GDEntity; |
|
|
|
namespace Kingo.Plugin.YJJK.View |
|
{ |
|
/// <summary> |
|
/// 属性维护 的交互逻辑 |
|
/// </summary> |
|
public partial class ViewSXWH : UserControl, IWizardFramework |
|
{ |
|
List<TestData> list = new List<TestData>(); |
|
public ViewSXWH() |
|
{ |
|
InitializeComponent(); |
|
list.Add(new TestData() { IsChecked = true, Descriction = "耕地坡度级别赋值(单纯变化增量)", ItemType = "GDPDJB_DLZL" }); |
|
list.Add(new TestData() { IsChecked = true, Descriction = "椭球面积计算", ItemType = "Area" }); |
|
list.Add(new TestData() { IsChecked = true, Descriction = "标识码赋值", ItemType = "BSM" }); |
|
list.Add(new TestData() { IsChecked = true, Descriction = "要素代码赋值", ItemType = "YSDM" }); |
|
list.Add(new TestData() { IsChecked = true, Descriction = "扣除地类系数", ItemType = "KCXS" }); |
|
list.Add(new TestData() { IsChecked = true, Descriction = "扣除面积计算", ItemType = "KCMJ" }); |
|
//list.Add(new TestData() { IsChecked = false, Descriction = "扣除地类系数维护(耕地未变化数据)", ItemType = "KCXS_GDWBH" }); |
|
ProjectInfo ProInfo = MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo; |
|
if (ProInfo != null && ProInfo.ProjType == EnumProjType.RCBG_BCGD || ProInfo.ProjType == EnumProjType.RCBG_ZJG) |
|
list.Add(new TestData() { IsChecked = true, Descriction = "项目属性赋值", ItemType = "XMSX" }); |
|
AttributeItemsSourse.ItemsSource = list; |
|
AttributeItemsSourse.MinRowHeight = 30; |
|
} |
|
|
|
private void FrmAttribute_Loaded(object sender, RoutedEventArgs e) |
|
{ |
|
InitGD();//初始化地类系数 |
|
} |
|
|
|
/// <summary> |
|
/// 全选-复选框 |
|
/// </summary> |
|
/// <param name="sender"></param> |
|
/// <param name="e"></param> |
|
private void CheckAll_Checked(object sender, RoutedEventArgs e) |
|
{ |
|
list.ForEach(f => f.IsChecked = (sender as CheckBox).IsChecked == true); |
|
} |
|
|
|
/// <summary> |
|
/// 取消按钮 |
|
/// </summary> |
|
/// <param name="sender"></param> |
|
/// <param name="e"></param> |
|
private void KImgCancel_Click(object sender, RoutedEventArgs e) |
|
{ |
|
} |
|
|
|
/// <summary> |
|
/// 确定按钮 |
|
/// </summary> |
|
/// <param name="sender"></param> |
|
/// <param name="e"></param> |
|
private void KImgSure_Click(object sender, RoutedEventArgs e) |
|
{ |
|
try |
|
{ |
|
this.ShowLoading("正在进行属性维护...", 0, 0); |
|
SXWHHelper sXWHHelper = new SXWHHelper(GDEntitys, list); |
|
sXWHHelper.Implement(); |
|
this.CloseLoading(); |
|
if (list.FirstOrDefault(x => x.IsChecked == true) != null) |
|
MessageHelper.ShowTips("属性维护成功!"); |
|
else |
|
MessageHelper.ShowError("请选择其中一项进行属性维护!"); |
|
} |
|
catch (Exception ex) |
|
{ |
|
ProgressHelper.CloseProcessBar(); |
|
LogAPI.Debug("属性维护异常信息:" + ex.Message); |
|
MessageHelper.ShowError("属性维护异常:" + ex.Message); |
|
} |
|
finally |
|
{ |
|
this.CloseLoading(); |
|
} |
|
} |
|
private XDocument xDoc; |
|
private List<GDEntity> GDEntitys; |
|
|
|
public object Parameter |
|
{ |
|
get; |
|
set; |
|
} |
|
private string m_strDescription = "此步骤将会提取地类图斑更新层和更新过程层数据"; |
|
public string Description |
|
{ |
|
get { return m_strDescription; } |
|
set { m_strDescription = value; } |
|
} |
|
private string m_strCaption = "属性维护"; |
|
public string Caption |
|
{ |
|
get { return m_strCaption; } |
|
set { m_strCaption = value; } |
|
} |
|
private bool m_bIsFinalSuccess = false; |
|
public bool IsFinalSuccess |
|
{ |
|
get { return m_bIsFinalSuccess; } |
|
set { m_bIsFinalSuccess = value; } |
|
} |
|
private bool m_IsSkip = false; |
|
public bool IsSkip |
|
{ |
|
get { return m_IsSkip; } |
|
set { m_IsSkip = value; } |
|
} |
|
|
|
public void InitGD() |
|
{ |
|
try |
|
{ |
|
GDEntitys = new List<GDEntity>(); |
|
string strPath = SysAppPath.GetBGGDLXConfigPath(); |
|
xDoc = XDocument.Load(strPath); |
|
foreach (XElement xElement in xDoc.Descendants("Item")) |
|
{ |
|
GDEntity model = new GDEntity(); |
|
model.Checked = true; |
|
model.GDLX = xElement.Attributes("GDLX").Single().Value; |
|
model.GDPDJB = xElement.Attributes("GDPDJB").Single().Value; |
|
model.GDPDJBMC = xElement.Attributes("GDPDJBMC").Single().Value; |
|
decimal kcdlxs = 0; |
|
if (decimal.TryParse(xElement.Attributes("KCDLXS").Single().Value, out kcdlxs)) |
|
{ |
|
model.KCDLXS = kcdlxs; |
|
} |
|
else |
|
{ |
|
model.KCDLXS = 0; |
|
} |
|
//model.XMSX = xElement.Attributes("XMSX").Single().Value; |
|
GDEntitys.Add(model); |
|
} |
|
} |
|
catch (Exception ex) |
|
{ |
|
MessageHelper.ShowTips("界面初始化失败,可能的原因是:" + ex.Message); |
|
} |
|
} |
|
|
|
public bool Execute() |
|
{ |
|
try |
|
{ |
|
SXWHHelper sXWHHelper = new SXWHHelper(GDEntitys, list); |
|
sXWHHelper.Implement(); |
|
if (list.FirstOrDefault(x => x.IsChecked == true) != null) |
|
m_bIsFinalSuccess = true; |
|
} |
|
catch (Exception ex) |
|
{ |
|
ProgressHelper.CloseProcessBar(); |
|
LogAPI.Debug("属性维护异常信息:" + ex.Message); |
|
MessageHelper.ShowError("属性维护异常:" + ex.Message); |
|
} |
|
finally |
|
{ |
|
this.CloseLoading(); |
|
} |
|
return m_bIsFinalSuccess; |
|
} |
|
|
|
public void Intializing(bool IsSkip = false) |
|
{ |
|
if (IsSkip) |
|
{ |
|
m_IsSkip = IsSkip; |
|
if ((Parameter as IDGParameter).ExtParam.Contains(this)) |
|
(Parameter as IDGParameter).ExtParam.Remove(this); |
|
} |
|
else |
|
{ |
|
if (Parameter is IDGParameter) |
|
{ |
|
if (!(Parameter as IDGParameter).ExtParam.Contains(this)) |
|
(Parameter as IDGParameter).ExtParam.Add(this); |
|
} |
|
} |
|
} |
|
|
|
public bool Validating() |
|
{ |
|
return true; |
|
} |
|
|
|
public void Back() |
|
{ |
|
} |
|
} |
|
}
|
|
|