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

208 lines
8.8 KiB

using DevExpress.Xpf.Editors;
using DevExpress.Xpf.LayoutControl;
using KGIS.Framework.DBOperator;
using KGIS.Framework.Maps;
using KGIS.Framework.Platform;
using KGIS.Framework.Utils;
using KGIS.Framework.Utils.ExtensionMethod;
using KGIS.Framework.Views;
using Kingo.PluginServiceInterface;
using Kingo.PluginServiceInterface.Model;
using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Xml;
using System.Xml.Linq;
using UIShell.OSGi;
namespace Kingo.Plugin.General.View
{
/// <summary>
/// UCSJSHYJ.xaml 的交互逻辑
/// </summary>
public partial class UCSJFKYJ : UserControl, IElementInfo
{
private NYYSInfo ReturnComments { get; set; }
public bool IsShow { get; set; }
public int ShowIndex { get; set; }
public bool ResetSize { get; set; }
public bool AllowEdit { get; set; }
public Guid ID { get; set; }
public DockStyle DockAreas { get; set; }
public System.Drawing.Size FloatSize { get; set; }
public int DockWidth { get; set; }
public int DockHeight { get; set; }
public DockStyle DefaultArea { get; set; }
public bool ShowCloseButton { get; set; }
public bool ShowAutoHideButton { get; set; }
public string Title { get; set; }
string TypeSystem = string.Empty;
List<PluginServiceInterface.Model.Attribute> attributeViewIsShows;
private List<IElementInfo> _Elements = null;
/// <summary>
/// 省级审核意见信息
/// </summary>
private IElementInfo _SHBZSketch = null;
public UCSJFKYJ()
{
InitializeComponent();
Title = "省级反馈意见";
TypeSystem = Platform.Instance.SystemType.ToString();
}
private void GetViewIsShow()
{
attributeViewIsShows = new List<PluginServiceInterface.Model.Attribute>();
try
{
string attributeViewIsShowFilePath = System.IO.Path.Combine(SysAppPath.GetConfigPath(), "AttributeShowConfigs.xml");
XDocument pXDoc = XDocument.Load(attributeViewIsShowFilePath);
var sdm = KGIS.Framework.Utils.SysConfigsOprator.GetAppsetingValueByKey("ArearName");
IEnumerable<XElement> elements = pXDoc.Element("Attributes").Elements().Where(x => x.Attribute("Name").Value.ToTrim().Contains(sdm));
var elements1 = elements.FirstOrDefault().Elements();
foreach (XElement item in elements1)
{
PluginServiceInterface.Model.Attribute attributeViewIsShow = new PluginServiceInterface.Model.Attribute();
attributeViewIsShow.Name = item.Attribute("Name").Value;
attributeViewIsShow.ViewName = item.Attribute("ViewName").Value;
attributeViewIsShow.Type = item.Attribute("Type") == null ? "" : item.Attribute("Type").Value;
attributeViewIsShow.IsShow = bool.Parse(item.Attribute("IsShow").Value);
attributeViewIsShows.Add(attributeViewIsShow);
}
}
catch (Exception ex)
{
LogAPI.Debug("获取属性配置异常:" + ex);
}
}
public void InitDTBInfoView()
{
try
{
if (_Elements == null)
{
_Elements = BundleRuntime.Instance.GetService<IElementInfo>();
}
if (_Elements == null)
return;
if (attributeViewIsShows == null) return;
#region 审核标注草图
if (attributeViewIsShows.Find(a => a.Name == "审核标注草图" && a.Type.Contains(TypeSystem)) != null && attributeViewIsShows.Find(a => a.Name == "审核标注草图" && a.Type.Contains(TypeSystem)).IsShow == true)
{
if (_SHBZSketch == null)
{
_SHBZSketch = _Elements.FirstOrDefault(f => f.Title == "审核标注草图");
}
if (_SHBZSketch != null && (_SHBZSketch as UserControl).Parent != null)
{
((_SHBZSketch as UserControl).Parent as Grid).Children.Clear();
}
if (_SHBZSketch != null)
{
SHBZSketch.Children.Add(_SHBZSketch as UIElement);
//审核标注
if (NYYSInfo != null)
_SHBZSketch.BindData(NYYSInfo);
}
else
LogAPI.Debug("加载-审核标注草图组件-失败!");
}
#endregion
}
catch (Exception ex)
{
LogAPI.Debug("初始化图斑详情页面失败!");
LogAPI.Debug(ex);
}
}
private NYYSInfo NYYSInfo { get; set; }
private TaskPackage taskPackage { get; set; }
System.Drawing.Size IDockPanel.FloatSize { get ; set ; }
public void BindData(object obj)
{
IRDBHelper rdbHelper = null;
try
{
NYYSInfo nYYSInfo = obj as NYYSInfo;
this.NYYSInfo = nYYSInfo;
//新疆需求
if (KGIS.Framework.Utils.SysConfigsOprator.GetAppsetingValueByKey("ArearName").Equals("65"))
{
GetViewIsShow();
InitDTBInfoView();
}
else
SHBZSketch.Visibility = Visibility.Collapsed;
if (nYYSInfo != null)
{
this.taskPackage = nYYSInfo.TaskPackages;
if (NYYSInfo.WYRWTB == null || string.IsNullOrWhiteSpace(NYYSInfo.WYRWTB.TBBSM) || taskPackage == null || string.IsNullOrWhiteSpace(taskPackage.PackageTempPath) || !System.IO.File.Exists(taskPackage.PackageTempPath))
{
this.DataContext = null;
return;
}
this.ReturnComments = new NYYSInfo();
rdbHelper = RDBFactory.CreateDbHelper($"{taskPackage.PackageTempPath}{(MapsManager.Instance.CurrProjectInfo as ProjectInfo).Pathpassword}", DatabaseType.SQLite);
if (!rdbHelper.TableIsExist("ReturnComments"))
{
this.DataContext = null;
this.DataContext = this.ReturnComments;
}
DataTable dataTable = rdbHelper.ExecuteDatatable("gjshyj", $"select * from ReturnComments where tbbsm='{NYYSInfo.WYRWTB.TBBSM}'", true);
this.LayoutControl.Children.Clear();
if (dataTable == null || dataTable.Rows.Count == 0) return;
this.ReturnComments.SHJG = KGIS.Framework.Utils.Utility.TBToList.ConvertEntity<SHJGInfo>(dataTable.Rows[0]);
this.DataContext = null;
this.DataContext = this.ReturnComments;
XmlDocument doc = new XmlDocument();
string strPath = System.IO.Path.Combine(SysAppPath.GetConfigPath(), "GeneralConfig.xml");
doc.Load(strPath);
XmlElement entityElem = (XmlElement)doc.SelectSingleNode("/GeneralConfig/SJSHJG");
foreach (XmlElement propElem in entityElem.SelectNodes("property"))
{
if (propElem.GetAttribute("Visibility") != "true") continue;
if (!dataTable.Columns.Contains(propElem.GetAttribute("Name"))) continue;
string value = dataTable.Rows[0][$"{propElem.GetAttribute("Name")}"].ToString();
LayoutItem layoutItem = new LayoutItem();
layoutItem.Label = $"{propElem.GetAttribute("LabelName")}:";
layoutItem.Height = 30;
layoutItem.LabelHorizontalAlignment = System.Windows.HorizontalAlignment.Right;
TextEdit textEdit = new TextEdit();
textEdit.Height = 27;
textEdit.IsReadOnly = true;
textEdit.Text = value.Replace("null", "").Trim();
layoutItem.Content = textEdit;
LayoutControl.Children.Add(layoutItem);
}
}
}
catch (Exception ex)
{
LogAPI.Debug($"{ex.Message}");
LogAPI.Debug($"{ex.Source}");
}
}
public void SaveEdit()
{
}
}
}