|
|
|
|
using DevExpress.Xpf.Grid;
|
|
|
|
|
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 KGIS.Framework.Utils.Interface;
|
|
|
|
|
using Kingo.Plugin.General.Helper;
|
|
|
|
|
using Kingo.PluginServiceInterface;
|
|
|
|
|
using Kingo.PluginServiceInterface.Helper;
|
|
|
|
|
using Kingo.PluginServiceInterface.Model;
|
|
|
|
|
using KUI.Windows;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Windows;
|
|
|
|
|
using System.Windows.Controls;
|
|
|
|
|
|
|
|
|
|
namespace Kingo.Plugin.DTBJK_XJ.View
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// UCLoadDTBJKData.xaml 的交互逻辑
|
|
|
|
|
/// </summary>
|
|
|
|
|
public partial class UCLoadDTBJKData : BaseWindow
|
|
|
|
|
{
|
|
|
|
|
JKTBTask taskList = null;
|
|
|
|
|
private int currentPage = 1;
|
|
|
|
|
private int pageSize = 50;// 每页显示的数据量
|
|
|
|
|
private int totalRecords = 100; // 总记录数
|
|
|
|
|
private int totalPages = 2; // 总页数
|
|
|
|
|
List<TaskPackage> taskPackages = new List<TaskPackage>();
|
|
|
|
|
private ProjectInfo projectInfo = null;
|
|
|
|
|
public UCLoadDTBJKData()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
this.Height = 520;
|
|
|
|
|
this.Width = 1000;
|
|
|
|
|
if (projectInfo == null)
|
|
|
|
|
projectInfo = MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo;
|
|
|
|
|
#region 生命周期
|
|
|
|
|
//生命周期 1:待分配 2:建库待领取 3:建库中 4:待解析 5:省级核查中 6:解析失败 7省级核查通过 8省级核查不通过
|
|
|
|
|
List<ListValue> list = new List<ListValue>();
|
|
|
|
|
list.Add(new ListValue("待领取", "2"));
|
|
|
|
|
list.Add(new ListValue("建库中", "3"));
|
|
|
|
|
list.Add(new ListValue("已上传", "4"));
|
|
|
|
|
list.Add(new ListValue("省级核查中", "5"));
|
|
|
|
|
list.Add(new ListValue("省级核查通过", "7"));
|
|
|
|
|
list.Add(new ListValue("省级核查不通过", "8"));
|
|
|
|
|
cycle.ItemsSource = list;
|
|
|
|
|
cycle.SelectedIndex = 0;
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 绑定业务类型
|
|
|
|
|
list = new List<ListValue>();
|
|
|
|
|
string ywlx = UserLoginHelper.GetAppsetingValueByKey("YWLX");
|
|
|
|
|
if (string.IsNullOrEmpty(ywlx))
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("业务类型获取失败", "提示信息", MessageBoxButton.OK);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
foreach (var item in ywlx.Split(','))
|
|
|
|
|
{
|
|
|
|
|
list.Add(new ListValue(item, item));
|
|
|
|
|
}
|
|
|
|
|
cbxYwlx.ItemsSource = list;
|
|
|
|
|
cbxYwlx.SelectedIndex = 0;
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 绑定图斑所在的包文件
|
|
|
|
|
string taskPath = projectInfo.TaskPath + "\\临时";
|
|
|
|
|
if (string.IsNullOrEmpty(taskPath) || !Directory.Exists(taskPath))
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("未检测到任务目录,请先设置任务目录。", "提示信息", MessageBoxButton.OK);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (projectInfo != null && projectInfo.ListTaskPackage != null && projectInfo.ListTaskPackage.Count != 0)
|
|
|
|
|
{
|
|
|
|
|
taskPackages = projectInfo.ListTaskPackage;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
string[] filePaths = Directory.GetDirectories(taskPath);
|
|
|
|
|
string fileName = "";
|
|
|
|
|
foreach (string filePath in filePaths)
|
|
|
|
|
{
|
|
|
|
|
fileName = System.IO.Path.GetFileName(filePath);
|
|
|
|
|
taskPackages.Add(new TaskPackage() { Ischeck = false, State = "未上传", PackageName = fileName, PackagePath = filePath });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
fileName.ItemsSource = taskPackages;
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
perPageNum.ItemsSource = new string[] { "10", "20", "50", "100", "200", "500" };
|
|
|
|
|
perPageNum.Text = "50";
|
|
|
|
|
|
|
|
|
|
//县镇村 地区代码
|
|
|
|
|
InittXZQDic();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void LoadData()
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
string userId = string.Empty, ywlx = string.Empty;
|
|
|
|
|
userId = UserLoginHelper.GetAppsetingValueByKey("UserId");
|
|
|
|
|
if (string.IsNullOrEmpty(userId) || int.Parse(userId) <= 0)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("用户ID获取失败", "提示信息", MessageBoxButton.OK);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
ywlx = cbxYwlx.SelectedValue.ToSafeString();
|
|
|
|
|
if (string.IsNullOrEmpty(ywlx))
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("业务类型获取失败", "提示信息", MessageBoxButton.OK);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
this.ShowLoading("正在加载,请稍候...", 0, 0);
|
|
|
|
|
|
|
|
|
|
//string sdm = "";
|
|
|
|
|
string xdm = "";
|
|
|
|
|
string zdm = "";
|
|
|
|
|
string cdm = "";
|
|
|
|
|
|
|
|
|
|
//if (cbxShidm.SelectedIndex > -1 && cbxShidm.SelectedItem != null && !string.IsNullOrEmpty(cbxShidm.SelectedItem.ToString()))
|
|
|
|
|
// sdm = cbxShidm.SelectedItem.ToString().Split('-')[0];
|
|
|
|
|
|
|
|
|
|
//后台接口不做修改 市级和县级选择 都用xzqdm字段传值查询请求
|
|
|
|
|
if (cbxXiandm.SelectedIndex > -1 && cbxXiandm.SelectedItem != null && !string.IsNullOrEmpty(cbxXiandm.SelectedItem.ToString()))
|
|
|
|
|
xdm = cbxXiandm.SelectedItem.ToString().Split('-')[0];
|
|
|
|
|
else if (cbxShidm.SelectedIndex > -1 && cbxShidm.SelectedItem != null && !string.IsNullOrEmpty(cbxShidm.SelectedItem.ToString()))
|
|
|
|
|
xdm = cbxShidm.SelectedItem.ToString().Split('-')[0];
|
|
|
|
|
if (cbxZhendm.SelectedIndex > -1 && cbxZhendm.SelectedItem != null && !string.IsNullOrEmpty(cbxZhendm.SelectedItem.ToString()))
|
|
|
|
|
zdm = cbxZhendm.SelectedItem.ToString().Split('-')[0];
|
|
|
|
|
if (cbxCundm.SelectedIndex > -1 && cbxCundm.SelectedItem != null && !string.IsNullOrEmpty(cbxCundm.SelectedItem.ToString()))
|
|
|
|
|
cdm = cbxCundm.SelectedItem.ToString().Split('-')[0];
|
|
|
|
|
|
|
|
|
|
IJKTBTask taskHelper = new JKTBTaskHelper();
|
|
|
|
|
taskList = taskHelper.LoadJKTBTask(ywlx, int.Parse(userId), Convert.ToInt32(cycle.SelectedValue), pageSize, currentPage, xdm, zdm, cdm);
|
|
|
|
|
|
|
|
|
|
if (taskList != null)
|
|
|
|
|
{
|
|
|
|
|
totalRecords = taskList.total;
|
|
|
|
|
total.Content = $"总数:【{totalRecords}】 ";
|
|
|
|
|
totalPages = (int)Math.Ceiling((double)totalRecords / pageSize);
|
|
|
|
|
rTotal.Text = totalPages.ToString();
|
|
|
|
|
currentPageNum.Content = $"当前页显示数:【{taskList.records.Count}】 ";
|
|
|
|
|
dgTableMapping.ItemsSource = taskList.records;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
dgTableMapping.ItemsSource = null;
|
|
|
|
|
}
|
|
|
|
|
this.CloseLoading();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
this.CloseLoading();
|
|
|
|
|
LogAPI.Debug("UCLoadDTBJKData.LoadData异常:" + ex.Message);
|
|
|
|
|
LogAPI.Debug("UCLoadDTBJKData.LoadData异常:" + ex.StackTrace);
|
|
|
|
|
throw ex;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 县镇村 地区代码
|
|
|
|
|
List<string> shidm = new List<string>();
|
|
|
|
|
List<string> xiandm = new List<string>();
|
|
|
|
|
List<string> zhendm = new List<string>();
|
|
|
|
|
List<string> cundm = new List<string>();
|
|
|
|
|
|
|
|
|
|
//市县镇村
|
|
|
|
|
private void InittXZQDic()
|
|
|
|
|
{
|
|
|
|
|
IRDBHelper rdbHelper = null;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
shidm.Clear();
|
|
|
|
|
if (projectInfo == null || string.IsNullOrEmpty(projectInfo.CODE)) return;
|
|
|
|
|
string systemPath = SysAppPath.GetDataBasePath() + "System.mdb";
|
|
|
|
|
if (File.Exists(systemPath))
|
|
|
|
|
{
|
|
|
|
|
string connStr = SysConfigsOprator.GetDBConnectionByName("MDBOledbConnection");
|
|
|
|
|
connStr = string.Format(connStr, systemPath);
|
|
|
|
|
rdbHelper = RDBFactory.CreateDbHelper(connStr, DatabaseType.MSAccess);
|
|
|
|
|
string strSQL = $"select distinct SDM, SMC from XZQ where SHDM = '{projectInfo.CODE.Substring(0, 2)}' ";
|
|
|
|
|
DataTable dt = rdbHelper.ExecuteDatatable("Dic", strSQL, true);
|
|
|
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
shidm.AddRange(dt.Rows.OfType<DataRow>().Where(r => r["SDM"] != null && !string.IsNullOrEmpty(r["SDM"].ToString())).Select(r => $"{r["SDM"].ToString()}" + "-" + $"{r["SMC"].ToString()}"));
|
|
|
|
|
}
|
|
|
|
|
cbxShidm.ItemsSource = shidm;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug("UCLoadDTBJKData.InittXZQDic 异常:" + ex.Message);
|
|
|
|
|
LogAPI.Debug("UCLoadDTBJKData.InittXZQDic 异常:" + ex.StackTrace);
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
if (rdbHelper != null)
|
|
|
|
|
rdbHelper.DisConnect();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
private void checkBox_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
JKTaskInfo tbm = dgTableMapping.SelectedItem as JKTaskInfo;
|
|
|
|
|
if (tbm != null)
|
|
|
|
|
{
|
|
|
|
|
tbm.ischeck = (bool)(sender as CheckBox).IsChecked;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void btnCreate_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
IRDBHelper rdbHelper = null;
|
|
|
|
|
IRDBHelper dbHelper = null;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (projectInfo == null)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("未找到工程文件,建议重新创建工程后操作。", "提示信息", MessageBoxButton.OK);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
//1、判断任务目录是否为空
|
|
|
|
|
string taskPath = projectInfo.TaskPath + "\\未完成";
|
|
|
|
|
if (string.IsNullOrEmpty(taskPath) || !Directory.Exists(taskPath))
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("未检测到任务目录,请先设置任务目录。", "提示信息", MessageBoxButton.OK);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
//2、判断是否选中建库数据
|
|
|
|
|
if (taskList == null || taskList.records == null || taskList.records.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("未检测到有建库任务数据。", "提示信息", MessageBoxButton.OK);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
List<JKTaskInfo> tasks = taskList.records.FindAll(a => a.ischeck == true);
|
|
|
|
|
if (tasks == null || tasks.Count <= 0)
|
|
|
|
|
//if (dgTableMapping.SelectedItems.Count <= 0)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("请选择要建库的图斑信息。", "提示信息", MessageBoxButton.OK);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
//3、创建建库任务DB包
|
|
|
|
|
if (!File.Exists(System.AppDomain.CurrentDomain.BaseDirectory + "Template\\JK_Task.jkrw"))
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("未检测到建库模板。", "提示信息", MessageBoxButton.OK);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.ShowLoading("正在生成任务,请稍候...", 0, 0);
|
|
|
|
|
string taskDBName = $"建库任务_{tasks.Count}个图斑_{DateTime.Now.ToString("yyyyMMddHHmmss")}.encrypt.jkrw";
|
|
|
|
|
string tempPath = System.AppDomain.CurrentDomain.BaseDirectory + "Temp";
|
|
|
|
|
if (!Directory.Exists(tempPath))
|
|
|
|
|
{
|
|
|
|
|
Directory.CreateDirectory(tempPath);
|
|
|
|
|
}
|
|
|
|
|
File.Copy(System.AppDomain.CurrentDomain.BaseDirectory + "Template\\JK_Task.jkrw", System.AppDomain.CurrentDomain.BaseDirectory + "Temp\\JK_Task.jkrw", true);
|
|
|
|
|
//4、写入建库数据
|
|
|
|
|
IJKTBTask taskHelper = new JKTBTaskHelper();
|
|
|
|
|
string strResult = taskHelper.CreateJKTask(tasks, cbxYwlx.SelectedValue.ToSafeString(), cycle.SelectedValue.ToSafeString(), System.AppDomain.CurrentDomain.BaseDirectory + "Temp\\JK_Task.jkrw");
|
|
|
|
|
if (!string.IsNullOrEmpty(strResult))
|
|
|
|
|
{
|
|
|
|
|
UserLoginHelper.UpdateAppsettingValueByKey("JkTaskDBName", projectInfo.TaskPath + "\\临时" + $"\\{taskDBName}\\" + taskDBName.Replace("encrypt.", ""));
|
|
|
|
|
UserLoginHelper.UpdateAppsettingValueByKey("JkTaskDBYWLX", cbxYwlx.SelectedValue.ToSafeString());
|
|
|
|
|
File.Copy(System.AppDomain.CurrentDomain.BaseDirectory + "Temp\\JK_Task.jkrw", taskPath + "\\" + taskDBName, true);
|
|
|
|
|
Platform.Instance.SendMsg(new NotifyMsgPackage() { MsgType = "LoadTreeData" });
|
|
|
|
|
#region 记录监测编号与任务包的对应关系
|
|
|
|
|
rdbHelper = RDBFactory.CreateDbHelper(System.IO.Path.Combine(projectInfo.ProjDir, "BGTJ.sqlite"), DatabaseType.SQLite);
|
|
|
|
|
#region 判断JCTB_TaskPackage表是否存在
|
|
|
|
|
rdbHelper.ExecuteNonQueryWithException(@"CREATE TABLE if not exists JCTB_TaskPackage ( ID integer NOT NULL PRIMARY KEY AUTOINCREMENT,JCBH TEXT(100),YWLX TEXT(50),PackageName TEXT(255),PackagePath TEXT(500),PackageTempPath TEXT(255)); ", System.Data.CommandType.Text);
|
|
|
|
|
#endregion
|
|
|
|
|
dbHelper = RDBFactory.CreateDbHelper($"{taskPath + "\\" + taskDBName}{(MapsManager.Instance.CurrProjectInfo as ProjectInfo).Pathpassword}", DatabaseType.SQLite);
|
|
|
|
|
DataTable dataTable = dbHelper.ExecuteDatatable("WYRW", "select TBBSM from WYRW", true);
|
|
|
|
|
StringBuilder stringBuilder = new StringBuilder();
|
|
|
|
|
if (dataTable != null && dataTable.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
foreach (DataRow item in dataTable.Rows)
|
|
|
|
|
{
|
|
|
|
|
var sql = $"INSERT INTO JCTB_TaskPackage (JCBH,YWLX,PackageName,PackagePath,PackageTempPath) VALUES('{item["TBBSM"]}','{cbxYwlx.SelectedValue.ToSafeString()}', '{taskDBName}', '{taskPath + "\\" + taskDBName}', '{projectInfo.TaskPath + "\\临时" + $"\\{taskDBName}\\" + taskDBName.Replace("encrypt.", "")}'); ";
|
|
|
|
|
stringBuilder.Append(sql);
|
|
|
|
|
|
|
|
|
|
//rdbHelper.ExecuteNonQueryWithException(sql, System.Data.CommandType.Text);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
rdbHelper.ExecuteNonQueryWithException(stringBuilder.ToString(), System.Data.CommandType.Text);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
this.CloseLoading();
|
|
|
|
|
MessageBox.Show(strResult, "提示信息", MessageBoxButton.OK);
|
|
|
|
|
LoadData();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("建库任务失败", "提示信息", MessageBoxButton.OK);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
this.CloseLoading();
|
|
|
|
|
LogAPI.Debug("UCLoadDTBJKData.btnCreate_Click生成任务失败:" + ex);
|
|
|
|
|
MessageHelper.ShowError("生成任务失败!" + ex.Message);
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
this.CloseLoading();
|
|
|
|
|
if (rdbHelper != null)
|
|
|
|
|
rdbHelper.DisConnect();
|
|
|
|
|
if (dbHelper != null)
|
|
|
|
|
dbHelper.DisConnect();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void btnSubmitJKTB_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
IRDBHelper rdbHelper = null;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if(projectInfo == null)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("未找到工程文件,建议重新创建工程后操作。", "提示信息", MessageBoxButton.OK);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
//1、判断任务目录是否为空
|
|
|
|
|
string taskPath = projectInfo.TaskPath + "\\未完成";
|
|
|
|
|
if (string.IsNullOrEmpty(taskPath) || !Directory.Exists(taskPath))
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("未检测到任务目录,请先设置任务目录。", "提示信息", MessageBoxButton.OK);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
//2、判断是否选中建库数据
|
|
|
|
|
if (taskList == null || taskList.records == null || taskList.records.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("未检测到有建库任务数据。", "提示信息", MessageBoxButton.OK);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
List<JKTaskInfo> tasks = taskList.records.FindAll(a => a.ischeck == true);
|
|
|
|
|
if (tasks == null || tasks.Count <= 0)
|
|
|
|
|
//if (dgTableMapping.SelectedItems.Count <= 0)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("请选择要建库的图斑信息。", "提示信息", MessageBoxButton.OK);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
//3.提交数据
|
|
|
|
|
IJKTBTask taskHelper = new JKTBTaskHelper();
|
|
|
|
|
string strtbbsm = string.Join(",", tasks.Select(x => $"'{x.tbbsm}'"));
|
|
|
|
|
rdbHelper = RDBFactory.CreateDbHelper(System.IO.Path.Combine(projectInfo.ProjDir, "BGTJ.sqlite"), DatabaseType.SQLite);
|
|
|
|
|
if (!rdbHelper.TableIsExist("JCTB_TaskPackage"))
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("未找到任务表,请先进行任务下发生成任务,作业后进行上传操作。", "提示信息", MessageBoxButton.OK);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
this.ShowLoading("正在进行任务上报......", 0, 0);
|
|
|
|
|
DataTable dataTable = rdbHelper.ExecuteDatatable("JCTB_TaskPackage", $" select distinct PackageTempPath, PackageName from JCTB_TaskPackage where JCBH in({strtbbsm}) ", true);
|
|
|
|
|
if (dataTable != null && dataTable.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
int successCount = 0, failCount = 0;
|
|
|
|
|
int successTBCount = 0, failTBCount = 0;
|
|
|
|
|
string errorMessage = "";
|
|
|
|
|
foreach (DataRow item in dataTable.Rows)
|
|
|
|
|
{
|
|
|
|
|
//var result = taskHelper.SaveJTTBData(item["PackagePath"].ToTrim(), cbxYwlx.SelectedValue.ToSafeString(), UserLoginHelper.GetAppsetingValueByKey("UserId"), out int ZT);
|
|
|
|
|
string tbbsmInTaskPackage = "";
|
|
|
|
|
DataTable dtTbbsm = rdbHelper.ExecuteDatatable("JCTB_TaskPackage", $" select distinct JCBH from JCTB_TaskPackage where PackageTempPath = '{item["PackageTempPath"].ToTrim()}'", true);
|
|
|
|
|
if (dtTbbsm != null && dtTbbsm.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
foreach (DataRow bsm in dtTbbsm.Rows)
|
|
|
|
|
{
|
|
|
|
|
if (bsm["JCBH"].ToTrim() != null && strtbbsm.Contains(bsm["JCBH"].ToTrim()))
|
|
|
|
|
tbbsmInTaskPackage += $"'{bsm["JCBH"].ToTrim()}',";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(tbbsmInTaskPackage))
|
|
|
|
|
tbbsmInTaskPackage = tbbsmInTaskPackage.TrimEnd(',');
|
|
|
|
|
|
|
|
|
|
var result = taskHelper.SaveJTTBData(item["PackageTempPath"].ToTrim(), cbxYwlx.SelectedValue.ToSafeString(), UserLoginHelper.GetAppsetingValueByKey("UserId"), tbbsmInTaskPackage);
|
|
|
|
|
if (result != null)
|
|
|
|
|
{
|
|
|
|
|
successTBCount += result.SuccessCount;
|
|
|
|
|
failTBCount += result.FailCount;
|
|
|
|
|
|
|
|
|
|
if (result.Code == 200)
|
|
|
|
|
{
|
|
|
|
|
successCount++;
|
|
|
|
|
LogAPI.Debug("任务包为" + item["PackageName"].ToTrim() + "上传成功 :" + result.Message);
|
|
|
|
|
//MessageBox.Show("任务包为" + item["PackageName"].ToTrim() + "上传:" + result.Message, "提示信息", MessageBoxButton.OK);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
failCount++;
|
|
|
|
|
LogAPI.Debug("任务包为" + item["PackageName"].ToTrim() + "数据上传成功失败 :" + result.Error);
|
|
|
|
|
errorMessage = result.Error;
|
|
|
|
|
//MessageBox.Show("任务包为" + item["PackageName"].ToTrim() + "数据上报失败:" + result.Error, "提示信息", MessageBoxButton.OK);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.CloseLoading();
|
|
|
|
|
|
|
|
|
|
if (dataTable.Rows.Count == successCount)
|
|
|
|
|
MessageHelper.ShowTips("任务包全部上传成功。" + $"变更范围图斑共计{successTBCount + failTBCount }个,成功上传{successTBCount}个,失败{failTBCount}个。");
|
|
|
|
|
else if (failCount > 0 && successCount > 0)
|
|
|
|
|
MessageHelper.ShowTips($"变更范围图斑共计{successTBCount + failTBCount }个,成功上传{successTBCount}个,失败{failTBCount}个。" + errorMessage);
|
|
|
|
|
else
|
|
|
|
|
MessageHelper.ShowTips("任务包全部上传失败。" + errorMessage + $"变更范围图斑共计{successTBCount + failTBCount }个,成功上传{successTBCount}个,失败{failTBCount}个。");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
System.Threading.Thread.Sleep(1000);
|
|
|
|
|
this.CloseLoading();
|
|
|
|
|
LogAPI.Debug("查找JCTB_TaskPackage记录为0,未找到任务包数据!");
|
|
|
|
|
MessageHelper.ShowTips("未找到任务包数据!");
|
|
|
|
|
}
|
|
|
|
|
this.CloseLoading();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug("数据上报失败" + ex.Message);
|
|
|
|
|
LogAPI.Debug("数据上报失败" + ex.StackTrace);
|
|
|
|
|
MessageHelper.ShowError("数据上报失败,原因是:" + ex.Message);
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
this.CloseLoading();
|
|
|
|
|
if (rdbHelper != null)
|
|
|
|
|
rdbHelper.DisConnect();
|
|
|
|
|
}
|
|
|
|
|
//try
|
|
|
|
|
//{
|
|
|
|
|
// IJKTBTask taskHelper = new JKTBTaskHelper();
|
|
|
|
|
// var result = taskHelper.SaveJTTBData("", cbxYwlx.SelectedValue.ToSafeString(), UserLoginHelper.GetAppsetingValueByKey("UserId"), out int ZT);
|
|
|
|
|
// if (result != null && result.Code == 200)
|
|
|
|
|
// {
|
|
|
|
|
// MessageBox.Show(result.Message, "提示信息", MessageBoxButton.OK);
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
// MessageBox.Show("数据上报失败," + result.Error, "提示信息", MessageBoxButton.OK);
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
//catch (Exception ex)
|
|
|
|
|
//{
|
|
|
|
|
// LogAPI.Debug("数据上报失败" + ex.Message);
|
|
|
|
|
// LogAPI.Debug("数据上报失败" + ex.StackTrace);
|
|
|
|
|
// MessageBox.Show("数据上报失败。", "提示信息", MessageBoxButton.OK);
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void AllCheckEidt_EditValueChanged(object sender, DevExpress.Xpf.Editors.EditValueChangedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (this.dgTableMapping == null || (dgTableMapping.ItemsSource as List<JKTaskInfo>) == null)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
List<JKTaskInfo> listTableMapping = dgTableMapping.ItemsSource as List<JKTaskInfo>;
|
|
|
|
|
bool check = (sender as DevExpress.Xpf.Editors.CheckEdit).IsChecked == null ? false : bool.Parse((sender as DevExpress.Xpf.Editors.CheckEdit).IsChecked.Value.ToString());
|
|
|
|
|
if (check)
|
|
|
|
|
{
|
|
|
|
|
//selectTbbsm = listTableMapping.Select(a => a.tbbsm).ToList();
|
|
|
|
|
listTableMapping.ForEach(a => a.ischeck = true);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//selectTbbsm.Clear();
|
|
|
|
|
listTableMapping.ForEach(a => a.ischeck = false);
|
|
|
|
|
}
|
|
|
|
|
dgTableMapping.RefreshData();
|
|
|
|
|
dgTableMapping.ItemsSource = null;
|
|
|
|
|
dgTableMapping.ItemsSource = listTableMapping;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
MessageHelper.ShowTips("全选发生异常:" + ex.Message);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#region 分页
|
|
|
|
|
private void FirstPageButton_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
currentPage = 1;
|
|
|
|
|
rCurrent.Text = currentPage.ToString();
|
|
|
|
|
LoadData();
|
|
|
|
|
}
|
|
|
|
|
private void PreviousPageButton_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (currentPage > 1)
|
|
|
|
|
{
|
|
|
|
|
currentPage--;
|
|
|
|
|
rCurrent.Text = currentPage.ToString();
|
|
|
|
|
LoadData();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private void NextPageButton_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
int totalPages = (int)Math.Ceiling((double)totalRecords / pageSize);
|
|
|
|
|
if (currentPage < totalPages)
|
|
|
|
|
{
|
|
|
|
|
currentPage++;
|
|
|
|
|
rCurrent.Text = currentPage.ToString();
|
|
|
|
|
LoadData();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private void LastPageButton_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
int totalPages = (int)Math.Ceiling((double)totalRecords / pageSize);
|
|
|
|
|
currentPage = totalPages;
|
|
|
|
|
rCurrent.Text = currentPage.ToString();
|
|
|
|
|
LoadData();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
private void perPageNum_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
string perPageNum = this.perPageNum.SelectedValue.ToString();
|
|
|
|
|
pageSize = int.Parse(perPageNum);
|
|
|
|
|
if (e.RemovedItems.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
LoadData();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void dgTableMapping_CustomColumnDisplayText(object sender, CustomColumnDisplayTextEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
//生命周期 1:待分配 2:建库待领取 3:建库中 4:待解析 5:省级核查中 6:解析失败 7省级核查通过 8省级核查不通过
|
|
|
|
|
#region 生命周期
|
|
|
|
|
if (e.Column.FieldName == "lifecycle")
|
|
|
|
|
{
|
|
|
|
|
switch ((int)e.Value)
|
|
|
|
|
{
|
|
|
|
|
case 2:
|
|
|
|
|
e.DisplayText = "待领取";
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
e.DisplayText = "建库中";
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
e.DisplayText = "已上传";
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
|
|
|
|
e.DisplayText = "省级核查中";
|
|
|
|
|
break;
|
|
|
|
|
case 7:
|
|
|
|
|
e.DisplayText = "省级核查通过";
|
|
|
|
|
break;
|
|
|
|
|
case 8:
|
|
|
|
|
e.DisplayText = "省级核查不通过";
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
e.DisplayText = "未获取到生命周期";
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug("dgTableMapping_CustomColumnDisplayText异常:" + ex.Message);
|
|
|
|
|
LogAPI.Debug("dgTableMapping_CustomColumnDisplayText异常:" + ex.StackTrace);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void cbxYwlx_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (cycle.SelectedValue != null && cbxYwlx.SelectedValue != null)
|
|
|
|
|
{
|
|
|
|
|
LoadData();
|
|
|
|
|
fileName.SelectedIndex = -1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//private void cbxDqdm_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
|
|
|
//{
|
|
|
|
|
// if (cbxDqdm.SelectedValue != null)
|
|
|
|
|
// {
|
|
|
|
|
// LoadData();
|
|
|
|
|
// fileName.SelectedIndex = -1;
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
private void cycle_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (cycle.SelectedValue != null && cbxYwlx.SelectedValue != null)
|
|
|
|
|
{
|
|
|
|
|
if (cycle.SelectedValue.ToTrim() != "2" && cycle.SelectedValue.ToTrim() != "3" && cycle.SelectedValue.ToTrim() != "8")
|
|
|
|
|
{
|
|
|
|
|
btnCreate.IsEnabled = false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
btnCreate.IsEnabled = true;
|
|
|
|
|
}
|
|
|
|
|
LoadData();
|
|
|
|
|
fileName.SelectedIndex = -1;
|
|
|
|
|
cbxShidm.SelectedIndex = -1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void fileName_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
IRDBHelper rdbHelper = null;
|
|
|
|
|
IRDBHelper rdbHelperTemp = null;
|
|
|
|
|
if (fileName.SelectedValue != null && cbxYwlx.SelectedValue != null)
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
rdbHelper = RDBFactory.CreateDbHelper(System.IO.Path.Combine(projectInfo.ProjDir, "BGTJ.sqlite"), DatabaseType.SQLite);
|
|
|
|
|
if (!rdbHelper.TableIsExist("JCTB_TaskPackage"))
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug("fileName_SelectionChanged异常:JCTB_TaskPackage表格不存在");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
DataTable dataTable = rdbHelper.ExecuteDatatable("JCTB_TaskPackage", $" select JCBH, PackageTempPath, PackageName, PackagePath from JCTB_TaskPackage where PackagePath='{fileName.SelectedValue.ToTrim()}' ", true);
|
|
|
|
|
if (dataTable != null && dataTable.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
#region 去掉未完成
|
|
|
|
|
string strTbbsm = "";
|
|
|
|
|
string packageTempPath = dataTable.Rows[0]["PackageTempPath"].ToTrim();
|
|
|
|
|
if (!string.IsNullOrEmpty(packageTempPath) && System.IO.File.Exists(packageTempPath))
|
|
|
|
|
{
|
|
|
|
|
rdbHelper = RDBFactory.CreateDbHelper($"{packageTempPath}{(MapsManager.Instance.CurrProjectInfo as ProjectInfo).Pathpassword}", DatabaseType.SQLite);
|
|
|
|
|
DataTable tempdataTable = rdbHelper.ExecuteDatatable("tempdataTable", "select tbbsm from wyrw where ZT <> '未完成' ", true);
|
|
|
|
|
if (tempdataTable != null && tempdataTable.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
strTbbsm = string.Join(",", tempdataTable.Rows.OfType<DataRow>().Select(r => $"{r[0].ToString()}"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
//string sdm = "";
|
|
|
|
|
string xdm = "";
|
|
|
|
|
string zdm = "";
|
|
|
|
|
string cdm = "";
|
|
|
|
|
|
|
|
|
|
//if (cbxShidm.SelectedIndex > -1 && cbxShidm.SelectedItem != null && !string.IsNullOrEmpty(cbxShidm.SelectedItem.ToString()))
|
|
|
|
|
// sdm = cbxShidm.SelectedItem.ToString().Split('-')[0];
|
|
|
|
|
|
|
|
|
|
//后台接口不做修改 市级和县级选择 都用xzqdm字段传值查询请求
|
|
|
|
|
if (cbxXiandm.SelectedIndex > -1 && cbxXiandm.SelectedItem != null && !string.IsNullOrEmpty(cbxXiandm.SelectedItem.ToString()))
|
|
|
|
|
xdm = cbxXiandm.SelectedItem.ToString().Split('-')[0];
|
|
|
|
|
else if (cbxShidm.SelectedIndex > -1 && cbxShidm.SelectedItem != null && !string.IsNullOrEmpty(cbxShidm.SelectedItem.ToString()))
|
|
|
|
|
xdm = cbxShidm.SelectedItem.ToString().Split('-')[0];
|
|
|
|
|
if (cbxZhendm.SelectedIndex > -1 && cbxZhendm.SelectedItem != null && !string.IsNullOrEmpty(cbxZhendm.SelectedItem.ToString()))
|
|
|
|
|
zdm = cbxZhendm.SelectedItem.ToString().Split('-')[0];
|
|
|
|
|
if (cbxCundm.SelectedIndex > -1 && cbxCundm.SelectedItem != null && !string.IsNullOrEmpty(cbxCundm.SelectedItem.ToString()))
|
|
|
|
|
cdm = cbxCundm.SelectedItem.ToString().Split('-')[0];
|
|
|
|
|
|
|
|
|
|
IJKTBTask taskHelper = new JKTBTaskHelper();
|
|
|
|
|
//去掉未完成
|
|
|
|
|
string strjcbh = string.Join(",", dataTable.Rows.OfType<DataRow>().Where(r => strTbbsm.Contains(r[0].ToString())).Select(r => $"{r[0].ToString()}"));
|
|
|
|
|
//string strjcbh = string.Join(",", dataTable.Rows.OfType<DataRow>().Select(r => $"{r[0].ToString()}"));
|
|
|
|
|
string userId = UserLoginHelper.GetAppsetingValueByKey("UserId");
|
|
|
|
|
taskList = taskHelper.LoadJKTBTask(cbxYwlx.SelectedValue.ToTrim(), int.Parse(userId), Convert.ToInt32(cycle.SelectedValue), 999999, 1, xdm, zdm, cdm);
|
|
|
|
|
|
|
|
|
|
#region 添加自主变更图斑
|
|
|
|
|
if (cycle.SelectedIndex > -1 && cycle.SelectedValue.ToString() == "3")
|
|
|
|
|
{
|
|
|
|
|
rdbHelperTemp = RDBFactory.CreateDbHelper($"{dataTable.Rows[0]["PackageTempPath"].ToString()}{(MapsManager.Instance.CurrProjectInfo as ProjectInfo).Pathpassword}", DatabaseType.SQLite);
|
|
|
|
|
//DataTable dataTableTemp = rdbHelperTemp.ExecuteDatatable("rdbHelperTemp", $" select * from wyrw where substr(TBBSM,7,4) = 'ZZBG' and ZT <> '已上传' ", true);
|
|
|
|
|
//去掉未完成
|
|
|
|
|
DataTable dataTableTemp = rdbHelperTemp.ExecuteDatatable("rdbHelperTemp", $" select * from wyrw where substr(TBBSM,7,4) = 'ZZBG' and ZT <> '已上传' and ZT <> '未完成' ", true);
|
|
|
|
|
if (dataTableTemp != null && dataTableTemp.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
foreach (DataRow bsm in dataTableTemp.Rows)
|
|
|
|
|
{
|
|
|
|
|
taskList.records.Add(new JKTaskInfo()
|
|
|
|
|
{
|
|
|
|
|
tbbsm = bsm["TBBSM"].ToTrim(),
|
|
|
|
|
lifecycle = 3,
|
|
|
|
|
username = UserLoginHelper.GetAppsetingValueByKey("UserName"),
|
|
|
|
|
bsm = taskList.records.Count + 1,
|
|
|
|
|
ischeck = false
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
strjcbh += "," + bsm["TBBSM"].ToTrim();
|
|
|
|
|
|
|
|
|
|
rdbHelper.ExecuteNonQueryWithException($"INSERT INTO JCTB_TaskPackage (JCBH,YWLX,PackageName,PackagePath,PackageTempPath) VALUES('{bsm["TBBSM"]}','{cbxYwlx.SelectedValue.ToSafeString()}', '{dataTable.Rows[0]["PackageName"].ToString()}', '{dataTable.Rows[0]["PackagePath"].ToString()}', '{dataTable.Rows[0]["PackageTempPath"].ToString()}'); ", System.Data.CommandType.Text);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
if (taskList != null)
|
|
|
|
|
{
|
|
|
|
|
taskList.records = taskList.records.Where(x => strjcbh.Contains(x.tbbsm)).ToList();
|
|
|
|
|
totalRecords = taskList.records.Count;
|
|
|
|
|
total.Content = $"总数:【{totalRecords}】 ";
|
|
|
|
|
totalPages = (int)Math.Ceiling((double)totalRecords / pageSize);
|
|
|
|
|
rTotal.Text = totalPages.ToString();
|
|
|
|
|
currentPageNum.Content = $"当前页显示数:【{taskList.records.Count}】 ";
|
|
|
|
|
dgTableMapping.ItemsSource = taskList.records;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
dgTableMapping.ItemsSource = null;
|
|
|
|
|
total.Content = $"总数:【0】 ";
|
|
|
|
|
currentPageNum.Content = $"当前页显示数:【0】 ";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
dgTableMapping.ItemsSource = null;
|
|
|
|
|
total.Content = $"总数:【0】 ";
|
|
|
|
|
currentPageNum.Content = $"当前页显示数:【0】 ";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug("fileName_SelectionChanged异常:" + ex.Message);
|
|
|
|
|
LogAPI.Debug("fileName_SelectionChanged异常:" + ex.StackTrace);
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
if (rdbHelper != null)
|
|
|
|
|
rdbHelper.DisConnect();
|
|
|
|
|
if (rdbHelperTemp != null)
|
|
|
|
|
rdbHelperTemp.DisConnect();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 县镇村 地区代码
|
|
|
|
|
|
|
|
|
|
//市县镇村 接口尚未完成
|
|
|
|
|
private void cbxShidm_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (cbxShidm.SelectedIndex < 0 || string.IsNullOrEmpty(cbxShidm.SelectedValue.ToString())) return;
|
|
|
|
|
IRDBHelper rdbHelper = null;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
xiandm.Clear();
|
|
|
|
|
cbxXiandm.SelectedIndex = -1;
|
|
|
|
|
cbxZhendm.SelectedIndex = -1;
|
|
|
|
|
cbxCundm.SelectedIndex = -1;
|
|
|
|
|
cbxXiandm.ItemsSource = null;
|
|
|
|
|
cbxZhendm.ItemsSource = null;
|
|
|
|
|
cbxCundm.ItemsSource = null;
|
|
|
|
|
string shiDM = cbxShidm.SelectedValue.ToString().Split('-')[0];
|
|
|
|
|
if (string.IsNullOrEmpty(shiDM) || string.IsNullOrWhiteSpace(shiDM)) return;
|
|
|
|
|
cbxXiandm.ItemsSource = GetResponseXZQDM(3, shiDM);
|
|
|
|
|
LoadData();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug(ex);
|
|
|
|
|
LogAPI.Debug("UCLoadDTBJKData.cbxXiandm_SelectionChanged 异常:" + ex.Message);
|
|
|
|
|
LogAPI.Debug("UCLoadDTBJKData.cbxXiandm_SelectionChanged 异常:" + ex.StackTrace);
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
if (rdbHelper != null)
|
|
|
|
|
rdbHelper.DisConnect();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void cbxXiandm_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (cbxXiandm.SelectedIndex < 0 || string.IsNullOrEmpty(cbxXiandm.SelectedValue.ToString())) return;
|
|
|
|
|
IRDBHelper rdbHelper = null;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
zhendm.Clear();
|
|
|
|
|
cbxZhendm.SelectedIndex = -1;
|
|
|
|
|
cbxCundm.SelectedIndex = -1;
|
|
|
|
|
cbxZhendm.ItemsSource = null;
|
|
|
|
|
cbxCundm.ItemsSource = null;
|
|
|
|
|
string xianDM = cbxXiandm.SelectedValue.ToString().Split('-')[0];
|
|
|
|
|
if (string.IsNullOrEmpty(xianDM) || string.IsNullOrWhiteSpace(xianDM)) return;
|
|
|
|
|
cbxZhendm.ItemsSource = GetResponseXZQDM(1, xianDM);
|
|
|
|
|
LoadData();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug(ex);
|
|
|
|
|
LogAPI.Debug("UCLoadDTBJKData.cbxXiandm_SelectionChanged 异常:" + ex.Message);
|
|
|
|
|
LogAPI.Debug("UCLoadDTBJKData.cbxXiandm_SelectionChanged 异常:" + ex.StackTrace);
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
if (rdbHelper != null)
|
|
|
|
|
rdbHelper.DisConnect();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private List<string> GetResponseXZQDM(int type, string dm)
|
|
|
|
|
{
|
|
|
|
|
List<string> qdm = new List<string>();
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
string url = $"{UserLoginHelper.GetAppsetingValueByKey("ApiHost")}nyprocess/GetConditionCounty/{type}/{dm}/{cbxYwlx.SelectedValue.ToSafeString()}";
|
|
|
|
|
ResultInfo<List<XZQDM>> requestData = HttpHelper.GetResponse<ResultInfo<List<XZQDM>>>(url);
|
|
|
|
|
if (requestData != null && requestData.Code == 200)
|
|
|
|
|
{
|
|
|
|
|
foreach (XZQDM item in requestData.Data)
|
|
|
|
|
{
|
|
|
|
|
if (item != null && item.qdm != null && item.qname != null)
|
|
|
|
|
{
|
|
|
|
|
qdm.Add(item.qdm + "-" + item.qname);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return qdm;
|
|
|
|
|
}
|
|
|
|
|
return qdm;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug("UCLoadDTBJKData.GetResponseXZQDM 异常:" + ex.Message);
|
|
|
|
|
LogAPI.Debug("UCLoadDTBJKData.GetResponseXZQDM 异常:" + ex.StackTrace);
|
|
|
|
|
return qdm;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void cbxZhendm_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (cbxZhendm.SelectedIndex < 0 || string.IsNullOrEmpty(cbxZhendm.SelectedValue.ToString())) return;
|
|
|
|
|
IRDBHelper rdbHelper = null;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
cundm.Clear();
|
|
|
|
|
cbxCundm.SelectedIndex = -1;
|
|
|
|
|
cbxCundm.ItemsSource = null;
|
|
|
|
|
string zhenDM = cbxZhendm.SelectedValue.ToString().Split('-')[0];
|
|
|
|
|
if (string.IsNullOrEmpty(zhenDM) || string.IsNullOrWhiteSpace(zhenDM)) return;
|
|
|
|
|
cbxCundm.ItemsSource = GetResponseXZQDM(2, zhenDM);
|
|
|
|
|
LoadData();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug(ex);
|
|
|
|
|
LogAPI.Debug("UCLoadDTBJKData.cbxZhendm_SelectionChanged 异常:" + ex.Message);
|
|
|
|
|
LogAPI.Debug("UCLoadDTBJKData.cbxZhendm_SelectionChanged 异常:" + ex.StackTrace);
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
if (rdbHelper != null)
|
|
|
|
|
rdbHelper.DisConnect();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void cbxCundm_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (cbxCundm.SelectedValue != null)
|
|
|
|
|
{
|
|
|
|
|
LoadData();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class XZQDM
|
|
|
|
|
{
|
|
|
|
|
public string qdm { get; set; }
|
|
|
|
|
public string qname { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|