|
|
|
|
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 Kingo.PluginServiceInterface.Helper;
|
|
|
|
|
using Kingo.PluginServiceInterface.Model;
|
|
|
|
|
using Kingo.RuleCheck;
|
|
|
|
|
using KUI.Windows;
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Concurrent;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Net.Http;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace Kingo.Plugin.General.Helper
|
|
|
|
|
{
|
|
|
|
|
public class JKTBTaskHelper : IJKTBTask
|
|
|
|
|
{
|
|
|
|
|
public JKTBDataInfo GetJKTBData(string tbbsm, string ywlx)
|
|
|
|
|
{
|
|
|
|
|
JKTBDataInfo jktbData = null;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
string url = $"{UserLoginHelper.GetAppsetingValueByKey("ApiHost")}nyprocess/GetJKTBInfoByTBBSM/{tbbsm}/{ywlx}";
|
|
|
|
|
ResultInfo<JKTBDataInfo> requestData = HttpHelper.GetResponse<ResultInfo<JKTBDataInfo>>(url);
|
|
|
|
|
if (requestData != null && requestData.Code == 200)
|
|
|
|
|
{
|
|
|
|
|
jktbData = requestData.Data;
|
|
|
|
|
//LogAPI.Debug("GetJKTBData信息:" + JsonConvert.SerializeObject(requestData.Data));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug("GetJKTBData异常:" + JsonConvert.SerializeObject(requestData.Data));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug("GetJKTBData异常:" + ex.Message);
|
|
|
|
|
LogAPI.Debug("GetJKTBData异常:" + ex.StackTrace);
|
|
|
|
|
}
|
|
|
|
|
return jktbData;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取任务图斑监测编号
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="XZQDM"></param>
|
|
|
|
|
/// <param name="YWName"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public object GetRWTBSEQ(string XZQDM, string YWName)
|
|
|
|
|
{
|
|
|
|
|
object jktbData = null;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
string url = $"{UserLoginHelper.GetAppsetingValueByKey("ApiHost")}nyprocess/GetRWTBSEQ/{XZQDM}/{YWName}";
|
|
|
|
|
ResultInfo<object> requestData = HttpHelper.GetResponse<ResultInfo<object>>(url);
|
|
|
|
|
if (requestData != null && requestData.Code == 200)
|
|
|
|
|
{
|
|
|
|
|
jktbData = requestData.Data;
|
|
|
|
|
}
|
|
|
|
|
if (jktbData == null)
|
|
|
|
|
{
|
|
|
|
|
throw (new Exception("获取任务图斑监测编号失败!"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug("获取任务图斑监测编号失败:" + ex);
|
|
|
|
|
}
|
|
|
|
|
return jktbData;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 加载建库任务数据
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="ywlx">业务类型</param>
|
|
|
|
|
/// <param name="userBsm">用户BSM</param>
|
|
|
|
|
/// <param name="lifecycle">图斑状态</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public JKTBTask LoadJKTBTask(string ywname, int userbsm, int lifecycle, int pageSize, int currentPage, string xdm, string zdm, string cdm)
|
|
|
|
|
{
|
|
|
|
|
JKTBTask task = null;
|
|
|
|
|
//int pagesize = 50, pageindex = 1;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var requestParam = new
|
|
|
|
|
{
|
|
|
|
|
ywname = ywname,
|
|
|
|
|
userbsm = userbsm,
|
|
|
|
|
lifecycle = lifecycle,
|
|
|
|
|
pagesize = pageSize,
|
|
|
|
|
pageindex = currentPage,
|
|
|
|
|
xzqdm = xdm,
|
|
|
|
|
Xzdm = zdm,
|
|
|
|
|
CjXzqdm = cdm
|
|
|
|
|
};
|
|
|
|
|
ResultInfo<JKTBTask> requestData = HttpHelper.PostResponse<ResultInfo<JKTBTask>>(UserLoginHelper.GetAppsetingValueByKey("ApiHost") + "nyprocess/GetJKTBTask", requestParam);
|
|
|
|
|
if (requestData != null && requestData.Code == 200)
|
|
|
|
|
{
|
|
|
|
|
task = requestData.Data;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug("LoadJKTBTask异常:" + ex.Message);
|
|
|
|
|
LogAPI.Debug("LoadJKTBTask异常:" + ex.StackTrace);
|
|
|
|
|
LogAPI.Debug($"LoadJKTBTask参数信息:{JsonConvert.SerializeObject(task)}");
|
|
|
|
|
}
|
|
|
|
|
return task;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<string> GetProperties<T>(T t)
|
|
|
|
|
{
|
|
|
|
|
List<string> ListStr = new List<string>();
|
|
|
|
|
if (t == null)
|
|
|
|
|
{
|
|
|
|
|
return ListStr;
|
|
|
|
|
}
|
|
|
|
|
System.Reflection.PropertyInfo[] properties = t.GetType().GetProperties(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public);
|
|
|
|
|
if (properties.Length <= 0)
|
|
|
|
|
{
|
|
|
|
|
return ListStr;
|
|
|
|
|
}
|
|
|
|
|
foreach (System.Reflection.PropertyInfo item in properties)
|
|
|
|
|
{
|
|
|
|
|
string name = item.Name; //名称
|
|
|
|
|
object value = item.GetValue(t, null); //值
|
|
|
|
|
|
|
|
|
|
if (item.PropertyType.IsValueType || item.PropertyType.Name.StartsWith("String"))
|
|
|
|
|
{
|
|
|
|
|
ListStr.Add(name);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
GetProperties(value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return ListStr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string CreateJKTask(List<JKTaskInfo> taskList, string ywlx, string cycle, string dbPath)
|
|
|
|
|
{
|
|
|
|
|
string strMessage = string.Empty, strSql = string.Empty;
|
|
|
|
|
int successCount = 0, failCount = 0;
|
|
|
|
|
IRDBHelper rdbHelper = null;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
rdbHelper = RDBFactory.CreateDbHelper($"{dbPath}{(MapsManager.Instance.CurrProjectInfo as ProjectInfo).Pathpassword}", DatabaseType.SQLite);
|
|
|
|
|
//rdbHelper.BeginTransaction();
|
|
|
|
|
|
|
|
|
|
string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss").ToSafeString();
|
|
|
|
|
strSql = $"INSERT INTO YSJ (BLX, BEdition, Encrypted, Pwd, CreateTime, CreateUser, UpdateUser, LastUpdateTime, WKID, RWPC, RuleVersion, PCTime, YWLX) VALUES('JK_Result', '1.0.0.0', 0, '', '{time}', '{taskList[0].username}', '{taskList[0].username}', '{time}', 4526, '', '', '', '')";
|
|
|
|
|
if (rdbHelper.ExecuteNonQuery(strSql, System.Data.CommandType.Text) > 0)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug($"CreateJKTask 信息:保存 YSJ 数据成功。");
|
|
|
|
|
}
|
|
|
|
|
foreach (var task in taskList)
|
|
|
|
|
{
|
|
|
|
|
string tbbsm = task.tbbsm;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
this.UpdateMsg($"正在生成任务......共计{taskList.Count}个,成功{successCount}个,失败{failCount}个。");
|
|
|
|
|
var jktbDataInfo = GetJKTBData(tbbsm, ywlx);
|
|
|
|
|
if (jktbDataInfo == null)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug($"CreateJKTask 信息:TBBSM:{tbbsm},YWLX:{ywlx},未获取到接口返回数据。");
|
|
|
|
|
failCount++;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//审核不通过的
|
|
|
|
|
if (!string.IsNullOrEmpty(cycle) && cycle == "8")
|
|
|
|
|
{
|
|
|
|
|
//保存 DTBDLTBGX 数据
|
|
|
|
|
if (jktbDataInfo.DTBDLTBGX == null || jktbDataInfo.DTBDLTBGX.Count <= 0)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug($"CreateJKTask 信息:TBBSM:{tbbsm},YWLX:{ywlx},DTBDLTBGX表没有数据。");
|
|
|
|
|
failCount++;
|
|
|
|
|
//continue;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
decimal kcxs = 0, kcmj = 0, gddb = 0, MAXX = 0, MAXY = 0, MINX = 0, MINY = 0, sjnf = 0;
|
|
|
|
|
if (!string.IsNullOrEmpty(jktbDataInfo.DTBDLTBGX[0].kcxs))
|
|
|
|
|
{
|
|
|
|
|
decimal.TryParse(jktbDataInfo.DTBDLTBGX[0].kcxs.Trim(), out kcxs);
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(jktbDataInfo.DTBDLTBGX[0].kcmj))
|
|
|
|
|
{
|
|
|
|
|
decimal.TryParse(jktbDataInfo.DTBDLTBGX[0].kcmj.Trim(), out kcmj);
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(jktbDataInfo.DTBDLTBGX[0].gddb))
|
|
|
|
|
{
|
|
|
|
|
decimal.TryParse(jktbDataInfo.DTBDLTBGX[0].gddb.Trim(), out gddb);
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(jktbDataInfo.DTBDLTBGX[0].maxx))
|
|
|
|
|
{
|
|
|
|
|
decimal.TryParse(jktbDataInfo.DTBDLTBGX[0].maxx.Trim(), out MAXX);
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(jktbDataInfo.DTBDLTBGX[0].maxy))
|
|
|
|
|
{
|
|
|
|
|
decimal.TryParse(jktbDataInfo.DTBDLTBGX[0].maxy.Trim(), out MAXY);
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(jktbDataInfo.DTBDLTBGX[0].minx))
|
|
|
|
|
{
|
|
|
|
|
decimal.TryParse(jktbDataInfo.DTBDLTBGX[0].minx.Trim(), out MINX);
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(jktbDataInfo.DTBDLTBGX[0].miny))
|
|
|
|
|
{
|
|
|
|
|
decimal.TryParse(jktbDataInfo.DTBDLTBGX[0].miny.Trim(), out MINY);
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(jktbDataInfo.DTBDLTBGX[0].sjnf))
|
|
|
|
|
{
|
|
|
|
|
decimal.TryParse(jktbDataInfo.DTBDLTBGX[0].sjnf.Trim(), out sjnf);
|
|
|
|
|
}
|
|
|
|
|
string fields = "BSM, TBBSM, YSDM, TBYBH, TBBH, DLBM, DLMC, QSXZ, QSDWDM, QSDWMC, ZLDWDM, ZLDWMC, TBMJ, KCDLBM, KCXS, KCMJ, TBDLMJ, GDLX, GDPDJB, XZDWKD, TBXHDM, TBXHMC, ZZSXDM, ZZSXMC, GDDB, FRDBS, CZCSXM, SJNF, MSSM, HDMC, BZ, EGeometry, GXSJ, TBLX, DDTCBZ, DDTCMC, SFGX, WBGYY, SFJZ, QKSM, LJLX, DCJL, MAXX, MAXY, MINX, MINY, YWTBSM, SHLZQKSM, NBWQKSM, SDMSSM, YDYHFL, LJBZ, JZYBH, LJTBBH, ZZZW, LXJZGLBH ";
|
|
|
|
|
|
|
|
|
|
string values = $"'{jktbDataInfo.DTBDLTBGX[0].bsm}', '{jktbDataInfo.DTBDLTBGX[0].tbbsm}', '{jktbDataInfo.DTBDLTBGX[0].ysdm}', '{jktbDataInfo.DTBDLTBGX[0].tbybh}', '{jktbDataInfo.DTBDLTBGX[0].tbbh}', '{jktbDataInfo.DTBDLTBGX[0].dlbm}', '{jktbDataInfo.DTBDLTBGX[0].dlmc}', '{jktbDataInfo.DTBDLTBGX[0].qsxz}', '{jktbDataInfo.DTBDLTBGX[0].qsdwdm}', '{jktbDataInfo.DTBDLTBGX[0].qsdwmc}', '{jktbDataInfo.DTBDLTBGX[0].zldwdm}', '{jktbDataInfo.DTBDLTBGX[0].zldwmc}', {jktbDataInfo.DTBDLTBGX[0].tbmj}, '{jktbDataInfo.DTBDLTBGX[0].kcdlbm}', {kcxs}, {kcmj}, {jktbDataInfo.DTBDLTBGX[0].tbdlmj}, '{jktbDataInfo.DTBDLTBGX[0].gdlx}', '{jktbDataInfo.DTBDLTBGX[0].gdpdjb}', {jktbDataInfo.DTBDLTBGX[0].xzdwkd}, '{jktbDataInfo.DTBDLTBGX[0].tbxhdm}', '{jktbDataInfo.DTBDLTBGX[0].tbxhmc}', '{jktbDataInfo.DTBDLTBGX[0].zzsxdm}', '{jktbDataInfo.DTBDLTBGX[0].zzsxmc}', {gddb}, '{jktbDataInfo.DTBDLTBGX[0].frdbs}', '{jktbDataInfo.DTBDLTBGX[0].czcsxm}', {sjnf}, '{jktbDataInfo.DTBDLTBGX[0].mssm}', '{jktbDataInfo.DTBDLTBGX[0].hdmc}', '{jktbDataInfo.DTBDLTBGX[0].bz}', '{jktbDataInfo.DTBDLTBGX[0].EGeometry}', '{jktbDataInfo.DTBDLTBGX[0].gxsj}', '{jktbDataInfo.DTBDLTBGX[0].tblx}', '{jktbDataInfo.DTBDLTBGX[0].ddtcbz}', '{jktbDataInfo.DTBDLTBGX[0].ddtcmc}', '{jktbDataInfo.DTBDLTBGX[0].sfgx}', '{jktbDataInfo.DTBDLTBGX[0].wbgyy}', '{jktbDataInfo.DTBDLTBGX[0].sfjz}', '{jktbDataInfo.DTBDLTBGX[0].qksm}', '{jktbDataInfo.DTBDLTBGX[0].ljlx}', '{jktbDataInfo.DTBDLTBGX[0].dcjl}', {MAXX}, {MAXY}, {MINX}, {MINY}, '{jktbDataInfo.DTBDLTBGX[0].ywtbsm}', '{jktbDataInfo.DTBDLTBGX[0].shlzqksm}', '{jktbDataInfo.DTBDLTBGX[0].nbwqksm}', '{jktbDataInfo.DTBDLTBGX[0].sdmssm}', '{jktbDataInfo.DTBDLTBGX[0].ydyhfl}', '{jktbDataInfo.DTBDLTBGX[0].ljbz}', '{jktbDataInfo.DTBDLTBGX[0].jzybh}', '{jktbDataInfo.DTBDLTBGX[0].ljtbbh}', '{jktbDataInfo.DTBDLTBGX[0].zzzw}' ";
|
|
|
|
|
|
|
|
|
|
string excuteSQL = string.Format("insert into DTBDLTBGX ({0}) values ({1})", fields, values);
|
|
|
|
|
if (rdbHelper.ExecuteNonQuery(excuteSQL, CommandType.Text) > 0)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug($"CreateJKTask 信息:TBBSM:{tbbsm},YWLX:{ywlx},保存 DTBDLTBGX 数据成功。");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug($"CreateJKTask 信息:TBBSM:{tbbsm},YWLX:{ywlx}, 写入 DTBDLTBGX 表数据失败。excuteSQL = " + excuteSQL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//保存 WYRW 数据
|
|
|
|
|
if (jktbDataInfo.WYRW == null || jktbDataInfo.WYRW.Count <= 0)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug($"CreateJKTask 信息:TBBSM:{tbbsm},YWLX:{ywlx},WYRW表没有数据。");
|
|
|
|
|
failCount++;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
decimal ZXDX = 0, ZXDY = 0, MAXX = 0, MAXY = 0, MINX = 0, MINY = 0;
|
|
|
|
|
if (!string.IsNullOrEmpty(jktbDataInfo.WYRW[0].x))
|
|
|
|
|
{
|
|
|
|
|
ZXDX = decimal.Parse(jktbDataInfo.WYRW[0].x.Trim());
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(jktbDataInfo.WYRW[0].y))
|
|
|
|
|
{
|
|
|
|
|
ZXDY = decimal.Parse(jktbDataInfo.WYRW[0].y.Trim());
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(jktbDataInfo.WYRW[0].maxx))
|
|
|
|
|
{
|
|
|
|
|
MAXX = decimal.Parse(jktbDataInfo.WYRW[0].maxx.Trim());
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(jktbDataInfo.WYRW[0].maxy))
|
|
|
|
|
{
|
|
|
|
|
MAXY = decimal.Parse(jktbDataInfo.WYRW[0].maxy.Trim());
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(jktbDataInfo.WYRW[0].minx))
|
|
|
|
|
{
|
|
|
|
|
MINX = decimal.Parse(jktbDataInfo.WYRW[0].minx.Trim());
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(jktbDataInfo.WYRW[0].miny))
|
|
|
|
|
{
|
|
|
|
|
MINY = decimal.Parse(jktbDataInfo.WYRW[0].miny.Trim());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
strSql = $"INSERT INTO WYRW (TBBSM, XZQDM, XZDM, JCBH, SJLY, JCMJ, TBMJ, Geometry, EGeometry, ZXDX, ZXDY, MAXX, MAXY, MINX, MINY, tblx, bz, jcdl) VALUES('{jktbDataInfo.WYRW[0].tbbsm}','{jktbDataInfo.WYRW[0].xzqdm}','{jktbDataInfo.WYRW[0].xzdm}','{jktbDataInfo.WYRW[0].jcbh}','{jktbDataInfo.WYRW[0].sjly}',{jktbDataInfo.WYRW[0].jcmj},{jktbDataInfo.WYRW[0].tbmj},'{jktbDataInfo.WYRW[0].shape}','{jktbDataInfo.WYRW[0].shape}',{ZXDX},{ZXDY},{MAXX},{MAXY},{MINX},{MINY}, '{jktbDataInfo.WYRW[0].tblx}', '{jktbDataInfo.WYRW[0].bz}', '{jktbDataInfo.WYRW[0].jcdl}' )";
|
|
|
|
|
if (rdbHelper.ExecuteNonQuery(strSql, System.Data.CommandType.Text) > 0)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug($"CreateJKTask 信息:TBBSM:{tbbsm},YWLX:{ywlx},保存 WYRW 数据成功。");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//failCount++;
|
|
|
|
|
LogAPI.Debug($"CreateJKTask 信息:TBBSM:{tbbsm},YWLX:{ywlx}, 写入 WYRW 表数据失败。strSql = " + strSql);
|
|
|
|
|
//rdbHelper.Rollback();
|
|
|
|
|
//continue;
|
|
|
|
|
}
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
string field = string.Empty;
|
|
|
|
|
if (!string.IsNullOrEmpty(jktbDataInfo.WYRW[0].detailjson))
|
|
|
|
|
{
|
|
|
|
|
var detailjson = jktbDataInfo.WYRW[0].detailjson.ToString().Substring(1, jktbDataInfo.WYRW[0].detailjson.Length - 2).Split(',').ToList();
|
|
|
|
|
rdbHelper.ExecuteNonQuery($"delete from detailjson where tbbsm='{tbbsm}'", System.Data.CommandType.Text);
|
|
|
|
|
StringBuilder stringBuilder = new StringBuilder();
|
|
|
|
|
foreach (var item in detailjson)
|
|
|
|
|
{
|
|
|
|
|
var sql = "";
|
|
|
|
|
if (!item.Contains(':'))
|
|
|
|
|
sql = $"INSERT INTO detailjson (Name,Value,tbbsm)VALUES( '{item.ToString().ToTrim().Trim('"')}','{item.ToString().ToTrim().Trim('"')}','{tbbsm}');";
|
|
|
|
|
else
|
|
|
|
|
sql = $"INSERT INTO detailjson (Name,Value,tbbsm)VALUES( '{item.Split(':')[0].ToString().ToTrim().Trim('"')}','{item.Split(':')[1].ToString().ToTrim().Trim('"')}','{tbbsm}');";
|
|
|
|
|
|
|
|
|
|
stringBuilder.Append(sql);
|
|
|
|
|
}
|
|
|
|
|
rdbHelper.ExecuteNonQuery(stringBuilder.ToString(), System.Data.CommandType.Text);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug($"jktbDataInfo.WYRW[0].detailjson 异常:TBBSM:{tbbsm},YWLX:{ywlx} ex.Message:{ex.Message} ex.StackTrace:{ex.StackTrace}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//if (jktbDataInfo.DTBDLTBGX == null || jktbDataInfo.DTBDLTBGX.Count <= 0)
|
|
|
|
|
//{
|
|
|
|
|
// LogAPI.Debug($"CreateJKTask 异常信息:TBBSM:{tbbsm},YWLX:{ywlx},DTBDLTBGX表没有数据。");
|
|
|
|
|
// failCount++;
|
|
|
|
|
// continue;
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
//保存 WYHCFJ 数据
|
|
|
|
|
if (jktbDataInfo.WYHCFJ == null || jktbDataInfo.WYHCFJ.Count <= 0)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug($"CreateJKTask 异常信息:TBBSM:{tbbsm},YWLX:{ywlx},WYHCFJ表没有数据。");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
using (BlockingCollection<WYHCFJItem> blockingCollection = new BlockingCollection<WYHCFJItem>())
|
|
|
|
|
{
|
|
|
|
|
jktbDataInfo.WYHCFJ.ForEach(x => blockingCollection.Add(x));
|
|
|
|
|
blockingCollection.CompleteAdding();
|
|
|
|
|
var taskFactory = Task.Factory;
|
|
|
|
|
var taskTaskList = new List<Task>();
|
|
|
|
|
var Lock = new object();
|
|
|
|
|
foreach (WYHCFJItem fj in blockingCollection.GetConsumingEnumerable())
|
|
|
|
|
{
|
|
|
|
|
taskTaskList.Add(taskFactory.StartNew(() =>
|
|
|
|
|
{
|
|
|
|
|
lock (Lock)
|
|
|
|
|
{
|
|
|
|
|
string fjmc = string.Empty;
|
|
|
|
|
if (!string.IsNullOrEmpty(fj.fjmc2))
|
|
|
|
|
{
|
|
|
|
|
fjmc = fj.fjmc2.Split('\\')[fj.fjmc2.Split('\\').Length - 1];
|
|
|
|
|
}
|
|
|
|
|
byte[] arg4 = new byte[128];
|
|
|
|
|
if (!string.IsNullOrEmpty(fj.fjmc2) && fj.fjmc2.Contains("http"))
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var httpClient = new HttpClient();
|
|
|
|
|
arg4 = httpClient.GetAsync(new Uri(fj.fjmc2.Replace("\\", "/"))).Result.Content.ReadAsByteArrayAsync().Result;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug("httpClient.GetAsync 异常:" + ex.Message);
|
|
|
|
|
LogAPI.Debug("httpClient.GetAsync 异常:" + ex.StackTrace);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
strSql = $"INSERT INTO WYHCFJ (HCLX, HCJLBSM, DKID, FJMC, FJLX, FJLJ, MODE, \"SEQUENCE\", SUBTYPE, ARG, ARG4, CJSJ, PSSJ, \"LENGTH\", POINTS_JSON, HCRY, IS_SELECTED) VALUES('WYRWTB','{fj.tbbsm}','{fj.tbbsm}','{fjmc}','{fj.fjlx}','{fj.fjmc2}','1',0,'1','{fj.arg}',@arg4,'{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}','{fj.pssj}',0,'{fj.points_json}','{fj.psry}', 1)";
|
|
|
|
|
IDbDataParameter[] parameters = new IDbDataParameter[1];
|
|
|
|
|
parameters[0] = new System.Data.SQLite.SQLiteParameter("arg4", DbType.Binary) { Value = arg4 };
|
|
|
|
|
if (rdbHelper.ExecuteNonQuery(strSql, System.Data.CommandType.Text, parameters) > 0)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug($"CreateJKTask 信息:TBBSM:{tbbsm},YWLX:{ywlx},保存 WYHCFJ 数据成功。");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//failCount++;
|
|
|
|
|
LogAPI.Debug($"CreateJKTask 信息:TBBSM:{tbbsm},YWLX:{ywlx}, 写入 WYHCFJ 表数据失败。strSql = " + strSql);
|
|
|
|
|
//continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
// 阻塞,等待所有任务都完成
|
|
|
|
|
Task.WaitAll(taskTaskList.ToArray());
|
|
|
|
|
for (int i = 0; i < taskTaskList.Count; i++)
|
|
|
|
|
taskTaskList[i].Dispose();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 保存省级反馈结果
|
|
|
|
|
if (jktbDataInfo.RGFL == null || jktbDataInfo.RGFL.Count <= 0)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug($"CreateJKTask 异常信息:TBBSM:{tbbsm},YWLX:{ywlx},RGFL表没有数据。");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var rgfl = jktbDataInfo.RGFL[0];
|
|
|
|
|
strSql = $"INSERT INTO ReturnComments (TBBSM,SHJG,JGSM,DLHCJG,DLHCSM,SXHCJG,SXHCSM,TXHCJG,TXHCSM,ZDJCJG,ZDJCSM,ZDJCJG_CONVERT,RGJCJG_CONVERT,RGJCSM,SHRY,SHSJ,BZ,JLDLHCJG,JLDLHCSM,JLSXHCJG,JLSXHCSM,JLTXHCJG,JLTXHCSM,JLSHSM,JLBZ,JLSHRY,JLSHSJ) VALUES('{rgfl.tbbsm}', '{rgfl.shjg}', '{rgfl.shsm}', '{rgfl.dlhcjg}', '{rgfl.dlhcsm}', '{rgfl.sxhcjg}','{rgfl.sxhcsm}','{rgfl.txhcjg}','{rgfl.txhcsm}','{rgfl.zdjcjg}','{rgfl.zdjcsm}','{rgfl.zdjcjg}','{rgfl.rgjcjg}','{rgfl.rgjcsm}','{rgfl.shry}','{rgfl.shsj}','{rgfl.bz}','{rgfl.jldlhcjg}','{rgfl.jldlhcsm}','{rgfl.jlsxhcjg}','{rgfl.jlsxhcsm}','{rgfl.jltxhcjg}','{rgfl.jltxhcsm}','{rgfl.jlshsm}','{rgfl.jlbz}','{rgfl.jlshry}','{rgfl.jlshsj}')";
|
|
|
|
|
|
|
|
|
|
if (rdbHelper.ExecuteNonQuery(strSql, System.Data.CommandType.Text) > 0)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug($"CreateJKTask 信息:TBBSM:{tbbsm},YWLX:{ywlx},保存 ReturnComments 数据成功。");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug($"CreateJKTask 信息:TBBSM:{tbbsm},YWLX:{ywlx}, 写入 ReturnComments 表数据失败。strSql = " + strSql);
|
|
|
|
|
//failCount++;
|
|
|
|
|
//rdbHelper.Rollback();
|
|
|
|
|
//continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 保存审核标注
|
|
|
|
|
if (jktbDataInfo.SHBZ == null || jktbDataInfo.SHBZ.Count <= 0)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug($"CreateJKTask 异常信息:TBBSM:{tbbsm},YWLX:{ywlx},SHBZ表没有数据。");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
foreach (SHBZItem item in jktbDataInfo.SHBZ)
|
|
|
|
|
{
|
|
|
|
|
var rgfl = item;
|
|
|
|
|
strSql = $"INSERT INTO SJSHBZ (TBBSM,BZLX,BZMS,Geometry,TBZT,UserID,BzRole) VALUES('{rgfl.bgfwbsm}', '{rgfl.bzlx}', '{rgfl.bzms}', '{rgfl.shape}', '{rgfl.tbzt}', '{rgfl.userid}','{rgfl.bzrole}')";
|
|
|
|
|
|
|
|
|
|
if (rdbHelper.ExecuteNonQuery(strSql, System.Data.CommandType.Text) > 0)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug($"CreateJKTask 信息:TBBSM:{tbbsm},YWLX:{ywlx},保存 SHBZ 数据成功。");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug($"CreateJKTask 信息:TBBSM:{tbbsm},YWLX:{ywlx}, 写入 SHBZ 表数据失败。strSql = " + strSql);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (UpdateTBLifecycle(ywlx, tbbsm, task.workerid, 3, task.lifecycle))
|
|
|
|
|
{
|
|
|
|
|
successCount++;
|
|
|
|
|
rdbHelper.Commit();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug("修改图斑生命周期失败," + JsonConvert.SerializeObject(task));
|
|
|
|
|
failCount++;
|
|
|
|
|
rdbHelper.Rollback();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug("写入表失败:" + ex);
|
|
|
|
|
failCount++;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
strMessage = $"建库任务分发完成。共计{taskList.Count}个,成功{successCount}个,失败{failCount}个。";
|
|
|
|
|
this.UpdateMsg(strMessage);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ee)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug("CreateJKTask ERROR信息:保存数据失败。");
|
|
|
|
|
LogAPI.Debug("CreateJKTask ERROR: " + ee);
|
|
|
|
|
strMessage = "";
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
if (rdbHelper.State == System.Data.ConnectionState.Open)
|
|
|
|
|
{
|
|
|
|
|
rdbHelper.DisConnect();
|
|
|
|
|
rdbHelper.Clear();
|
|
|
|
|
}
|
|
|
|
|
rdbHelper = null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return strMessage;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static List<T> ToList<T>(DataTable dt)
|
|
|
|
|
{
|
|
|
|
|
if (dt == null || dt.Rows.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
return new List<T>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PropertyInfo[] properties = typeof(T).GetProperties();//获取实体类型的属性集合
|
|
|
|
|
List<T> list = new List<T>();
|
|
|
|
|
T model = default(T);
|
|
|
|
|
foreach (DataRow dr in dt.Rows)
|
|
|
|
|
{
|
|
|
|
|
model = System.Activator.CreateInstance<T>();//创建实体
|
|
|
|
|
foreach (PropertyInfo p in properties)
|
|
|
|
|
{
|
|
|
|
|
foreach (DataColumn col in dt.Columns)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (col.ColumnName.ToLower().Equals(p.Name.ToLower()))
|
|
|
|
|
{
|
|
|
|
|
object obj = dr[col.ColumnName];
|
|
|
|
|
if (obj == null || obj is DBNull)
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
if (obj.ToString().Replace(" ", "").Length == 0)
|
|
|
|
|
break;
|
|
|
|
|
if (p.PropertyType == typeof(string))
|
|
|
|
|
{
|
|
|
|
|
p.SetValue(model, obj.ToString(), null);
|
|
|
|
|
}
|
|
|
|
|
else if (p.PropertyType == typeof(object))
|
|
|
|
|
{
|
|
|
|
|
p.SetValue(model, (object)(obj.ToString()), null);
|
|
|
|
|
}
|
|
|
|
|
else if (p.PropertyType == typeof(int) || p.PropertyType == typeof(int?))
|
|
|
|
|
{
|
|
|
|
|
p.SetValue(model, int.Parse(obj.ToString()), null);
|
|
|
|
|
}
|
|
|
|
|
else if (p.PropertyType == typeof(DateTime) || p.PropertyType == typeof(DateTime?))
|
|
|
|
|
{
|
|
|
|
|
p.SetValue(model, DateTime.Parse(obj.ToString()), null);
|
|
|
|
|
}
|
|
|
|
|
else if (p.PropertyType == typeof(float) || p.PropertyType == typeof(float?))
|
|
|
|
|
{
|
|
|
|
|
p.SetValue(model, float.Parse(obj.ToString()), null);
|
|
|
|
|
}
|
|
|
|
|
else if (p.PropertyType == typeof(double) || p.PropertyType == typeof(double?))
|
|
|
|
|
{
|
|
|
|
|
p.SetValue(model, double.Parse(obj.ToString()), null);
|
|
|
|
|
}
|
|
|
|
|
else if (p.PropertyType == typeof(decimal) || p.PropertyType == typeof(decimal?))
|
|
|
|
|
{
|
|
|
|
|
p.SetValue(model, decimal.Parse(obj.ToString()), null);
|
|
|
|
|
}
|
|
|
|
|
else if (p.PropertyType == typeof(bool) || p.PropertyType == typeof(bool?))
|
|
|
|
|
{
|
|
|
|
|
bool b = false;
|
|
|
|
|
if (Boolean.TryParse(obj.ToString(), out b))
|
|
|
|
|
{
|
|
|
|
|
p.SetValue(model, b, null);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (obj.ToString().Equals("0"))
|
|
|
|
|
{
|
|
|
|
|
p.SetValue(model, false, null);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
p.SetValue(model, true, null);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (p.PropertyType == typeof(Byte[]))
|
|
|
|
|
{
|
|
|
|
|
p.SetValue(model, obj as Byte[], null);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
throw ex;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
list.Add(model);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ResultInfo<bool> SaveJTTBData(string dbPath, string ywlx, string userId, out int ZT)
|
|
|
|
|
{
|
|
|
|
|
// ZT -1 未完成(未变化)
|
|
|
|
|
// 0 全部成功
|
|
|
|
|
// 1 部分成功
|
|
|
|
|
// 2 失败
|
|
|
|
|
ZT = -1;
|
|
|
|
|
if (string.IsNullOrEmpty(dbPath) || !System.IO.File.Exists(dbPath))
|
|
|
|
|
{
|
|
|
|
|
MessageHelper.Show("此任务包为空或者在图斑操作完成之后才允许上传!");
|
|
|
|
|
LogAPI.Debug("此任务包为空或者在图斑操作完成之后才允许上传!");
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
ResultInfo<bool> result = new ResultInfo<bool>();
|
|
|
|
|
JKTBDataInfo jkResult = new JKTBDataInfo();
|
|
|
|
|
jkResult.WYRW = new List<WYRWItem>();
|
|
|
|
|
jkResult.DTBDLTBGX = new List<DTBDLTBGXItem>();
|
|
|
|
|
jkResult.DTBDLTBGXGC = new List<DTBDLTBGXGCItem>();
|
|
|
|
|
jkResult.DTBLSYDGX = new List<DTBLSYDGXItem>();
|
|
|
|
|
jkResult.DTBGFBQGX = new List<DTBGFBQGXItem>();
|
|
|
|
|
jkResult.DTBTTQGX = new List<DTBTTQGXItem>();
|
|
|
|
|
jkResult.DTBLMFWGX = new List<DTBLMFWGXItem>();
|
|
|
|
|
jkResult.DTBCCWJQGX = new List<DTBCCWJQGXItem>();
|
|
|
|
|
jkResult.DTBCZCDYDGX = new List<DTBCZCDYDGXItem>();
|
|
|
|
|
jkResult.WYHCFJ = new List<WYHCFJItem>();
|
|
|
|
|
jkResult.FJGX = new List<FJGXItem>();
|
|
|
|
|
jkResult.RGFL = new List<RGFLItem>();
|
|
|
|
|
//dbPath = UserLoginHelper.GetAppsetingValueByKey("JkTaskDBName");
|
|
|
|
|
IRDBHelper rdbHelper = null;
|
|
|
|
|
string strSql = string.Empty, strResult = string.Empty;
|
|
|
|
|
DataTable dt = null, dtTbbsm = null;
|
|
|
|
|
int successCount = 0, failCount = 0;
|
|
|
|
|
string EGeometry = string.Empty;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
rdbHelper = RDBFactory.CreateDbHelper($"{dbPath}{(MapsManager.Instance.CurrProjectInfo as ProjectInfo).Pathpassword}", DatabaseType.SQLite);
|
|
|
|
|
strSql = "select distinct tbbsm from dtbdltbgx";
|
|
|
|
|
dtTbbsm = rdbHelper.ExecuteDatatable("dtbdltbgx", strSql, true);
|
|
|
|
|
if (dtTbbsm != null && dtTbbsm.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < dtTbbsm.Rows.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
//查询 DTBDLTBGX
|
|
|
|
|
strSql = $"select bsm,tbbsm,tbybh,dlbm,dlmc,tbmj,kcdlbm,tbdlmj,gdlx,xzdwkd,tbxhdm,tbxhmc,zzsxdm,zzsxmc,czcsxm,bz,EGeometry,gxsj,tblx,sfgx,wbgyy,sfjz,qksm,ljlx,maxx,maxy,minx,miny,ywtbsm,shlzqksm,nbwqksm,sdmssm,ydyhfl,czctbbh,qsxz,qsdwdm,qsdwmc,zldwdm,zldwmc,sjnf,ddtcbz,ddtcmc from dtbdltbgx where tbbsm = '{dtTbbsm.Rows[i]["tbbsm"].ToString()}'";
|
|
|
|
|
dt = rdbHelper.ExecuteDatatable("dtbdltbgx", strSql, true);
|
|
|
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
jkResult.DTBDLTBGX = KGIS.Framework.Utils.Utility.TBToList.ToList<DTBDLTBGXItem>(dt);
|
|
|
|
|
foreach (DataRow row in dt.Rows)
|
|
|
|
|
{
|
|
|
|
|
RGFLItem rgfl = new RGFLItem();
|
|
|
|
|
WLHRGChecker check = new WLHRGChecker(row["bsm"].ToString(), dbPath, null);
|
|
|
|
|
rgfl.bgfwbsm = row["bsm"].ToString();
|
|
|
|
|
rgfl.rgrule = check.CheckDL();
|
|
|
|
|
jkResult.RGFL.Add(rgfl);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//查询 DTBDLTBGXGC
|
|
|
|
|
strSql = $"select bsm, tbbsm, bgxw, xzqtzlx, tbbgmj, bgqbsm, bgqtbbh, bgqdlbm, bgqdlmc, bgqqsxz, bgqqsdwdm, bgqqsdwmc, bgqzldwdm, bgqzldwmc, bgqkcdlbm, bgqkcxs, bgqkcmj, bgqtbdlmj, bgqgdlx, bgqgdpdjb, bgqxzdwkd, bgqtbxhdm, bgqtbxhmc, bgqzzsxdm, bgqzzsxmc, bgqgddb, bgqfrdbs, bgqczcsxm, bgqmssm, bgqhdmc, bghtbbsm, bghtbbh, bghdlbm, bghdlmc, bghqsxz, bghqsdwdm, bghqsdwmc, bghzldwdm, bghzldwmc, bghkcdlbm, bghkcxs, bghkcmj, bghtbdlmj, bghgdlx, bghgdpdjb, bghxzdwkd, bghtbxhdm, bghtbxhmc, bghzzsxdm, bghzzsxmc, bghgddb, bghfrdbs, bghczcsxm, bghmssm, bghhdmc, gxsj,EGeometry from DTBDLTBGXGC where tbbsm = '{dtTbbsm.Rows[i]["tbbsm"].ToString()}'";
|
|
|
|
|
if (dt != null)
|
|
|
|
|
{
|
|
|
|
|
dt.Clear();
|
|
|
|
|
dt = null;
|
|
|
|
|
}
|
|
|
|
|
dt = rdbHelper.ExecuteDatatable("DTBDLTBGXGC", strSql, true);
|
|
|
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
jkResult.DTBDLTBGXGC = KGIS.Framework.Utils.Utility.TBToList.ToList<DTBDLTBGXGCItem>(dt);
|
|
|
|
|
}
|
|
|
|
|
//查询 DTBLSYDGX
|
|
|
|
|
strSql = $"SELECT A.BSM, A.DDTCBZ, A.DDTCMC, A.YSDM, A.GLTBBSM, A.PZWJMC, A.PZWH, A.TBMJ, A.PZMJ, A.YTFL, A.JTXMYT, A.PZRQ, A.YQSX, A.TDSYHT, A.BZ, A.GXSJ,B.EGeometry FROM DTBLSYDGX A left join DTBDLTBGX B on A.BSM = b.BSM where A.bsm in (select bsm from DTBDLTBGX where tbbsm = '{ dtTbbsm.Rows[i]["tbbsm"].ToString()}') ";
|
|
|
|
|
if (dt != null)
|
|
|
|
|
{
|
|
|
|
|
dt.Clear();
|
|
|
|
|
dt = null;
|
|
|
|
|
}
|
|
|
|
|
dt = rdbHelper.ExecuteDatatable("DTBLSYDGX", strSql, true);
|
|
|
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
jkResult.DTBLSYDGX = KGIS.Framework.Utils.Utility.TBToList.ToList<DTBLSYDGXItem>(dt);
|
|
|
|
|
}
|
|
|
|
|
//查询 DTBGFBQGX
|
|
|
|
|
strSql = $"SELECT A.BSM, A.DDTCBZ, A.DDTCMC, A.YSDM, A.XMMC, A.XMGM, A.QYMJ, A.PZYDSJ, A.BZ, A.GXSJ,B.EGeometry FROM DTBGFBQGX A left join DTBDLTBGX B on A.BSM = b.BSM where A.bsm in ( select bsm from DTBDLTBGX where tbbsm = '{ dtTbbsm.Rows[i]["tbbsm"].ToString()}' )";
|
|
|
|
|
if (dt != null)
|
|
|
|
|
{
|
|
|
|
|
dt.Clear();
|
|
|
|
|
dt = null;
|
|
|
|
|
}
|
|
|
|
|
dt = rdbHelper.ExecuteDatatable("DTBGFBQGX", strSql, true);
|
|
|
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
jkResult.DTBGFBQGX = KGIS.Framework.Utils.Utility.TBToList.ToList<DTBGFBQGXItem>(dt);
|
|
|
|
|
}
|
|
|
|
|
//查询 DTBTTQGX
|
|
|
|
|
strSql = $"SELECT A.BSM, A.DDTCBZ, A.DDTCMC, A.YSDM, A.TTQMJ, A.BZ, A.GXSJ ,B.EGeometry FROM DTBTTQGX A left join DTBDLTBGX B on A.BSM = b.BSM where A.bsm in (select bsm from DTBDLTBGX where tbbsm = '{ dtTbbsm.Rows[i]["tbbsm"].ToString()}')";
|
|
|
|
|
if (dt != null)
|
|
|
|
|
{
|
|
|
|
|
dt.Clear();
|
|
|
|
|
dt = null;
|
|
|
|
|
}
|
|
|
|
|
dt = rdbHelper.ExecuteDatatable("DTBTTQGX", strSql, true);
|
|
|
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
jkResult.DTBTTQGX = KGIS.Framework.Utils.Utility.TBToList.ToList<DTBTTQGXItem>(dt);
|
|
|
|
|
}
|
|
|
|
|
//查询 DTBLMFWGX
|
|
|
|
|
strSql = $"SELECT A.BSM, A.DDTCBZ, A.DDTCMC, A.YSDM, A.ZLDWDM, A.KD, A.MJ, A.DLBM, A.MC, A.BZ, A.GXSJ ,B.EGeometry FROM DTBLMFWGX A left join DTBDLTBGX B on A.BSM = b.BSM where A.bsm in (select bsm from DTBDLTBGX where tbbsm = '{ dtTbbsm.Rows[i]["tbbsm"].ToString()}') ";
|
|
|
|
|
if (dt != null)
|
|
|
|
|
{
|
|
|
|
|
dt.Clear();
|
|
|
|
|
dt = null;
|
|
|
|
|
}
|
|
|
|
|
dt = rdbHelper.ExecuteDatatable("DTBLMFWGX", strSql, true);
|
|
|
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
jkResult.DTBLMFWGX = KGIS.Framework.Utils.Utility.TBToList.ToList<DTBLMFWGXItem>(dt);
|
|
|
|
|
}
|
|
|
|
|
//查询 DTBCCWJQGX
|
|
|
|
|
strSql = $" SELECT A.BSM, A.DDTCBZ, A.DDTCMC, A.YSDM, A.ZDMJ, A.BZ, A.GXSJ,B.EGeometry FROM DTBCCWJQGX A left join DTBDLTBGX B on A.BSM = b.BSM where A.bsm in (select bsm from DTBDLTBGX where tbbsm = '{ dtTbbsm.Rows[i]["tbbsm"].ToString()}') ";
|
|
|
|
|
if (dt != null)
|
|
|
|
|
{
|
|
|
|
|
dt.Clear();
|
|
|
|
|
dt = null;
|
|
|
|
|
}
|
|
|
|
|
dt = rdbHelper.ExecuteDatatable("DTBCCWJQGX", strSql, true);
|
|
|
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
jkResult.DTBCCWJQGX = KGIS.Framework.Utils.Utility.TBToList.ToList<DTBCCWJQGXItem>(dt);
|
|
|
|
|
}
|
|
|
|
|
//查询 DTBCZCDYDGX
|
|
|
|
|
strSql = $" SELECT A.BSM, A.DDTCBZ, A.DDTCMC, A.YSDM, A.CZCLX, A.CZCDM, A.CZCMC, A.CZCMJ, A.BZ, A.GXSJ,B.EGeometry FROM DTBCZCDYDGX A left join DTBDLTBGX B on A.BSM = b.BSM where A.bsm in (select bsm from DTBDLTBGX where tbbsm = '{ dtTbbsm.Rows[i]["tbbsm"].ToString()}') ";
|
|
|
|
|
if (dt != null)
|
|
|
|
|
{
|
|
|
|
|
dt.Clear();
|
|
|
|
|
dt = null;
|
|
|
|
|
}
|
|
|
|
|
dt = rdbHelper.ExecuteDatatable("DTBCZCDYDGX", strSql, true);
|
|
|
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
jkResult.DTBCZCDYDGX = KGIS.Framework.Utils.Utility.TBToList.ToList<DTBCZCDYDGXItem>(dt);
|
|
|
|
|
}
|
|
|
|
|
//查询 FJGX
|
|
|
|
|
strSql = $"SELECT WYTBBSM, FJARG, TBBSM FROM FJGX WHERE WYTBBSM = '{dtTbbsm.Rows[i]["tbbsm"].ToString()}'";
|
|
|
|
|
if (dt != null)
|
|
|
|
|
{
|
|
|
|
|
dt.Clear();
|
|
|
|
|
dt = null;
|
|
|
|
|
}
|
|
|
|
|
dt = rdbHelper.ExecuteDatatable("FJGX", strSql, true);
|
|
|
|
|
|
|
|
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
jkResult.FJGX = KGIS.Framework.Utils.Utility.TBToList.ToList<FJGXItem>(dt);
|
|
|
|
|
}
|
|
|
|
|
//查询 WYRW
|
|
|
|
|
strSql = $"SELECT TBBSM, XZQDM, XZDM, JCBH, SJLY, JCMJ, TBMJ, Geometry, EGeometry, ZXDX, ZXDY, MAXX, MAXY, MINX, MINY FROM WYRW WHERE TBBSM = '{dtTbbsm.Rows[i]["tbbsm"].ToString()}'";
|
|
|
|
|
if (dt != null)
|
|
|
|
|
{
|
|
|
|
|
dt.Clear();
|
|
|
|
|
dt = null;
|
|
|
|
|
}
|
|
|
|
|
dt = rdbHelper.ExecuteDatatable("WYRW", strSql, true);
|
|
|
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
jkResult.WYRW = KGIS.Framework.Utils.Utility.TBToList.ToList<WYRWItem>(dt);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!CheckErrorResult(dtTbbsm.Rows[i]["tbbsm"].ToString(), rdbHelper))
|
|
|
|
|
{
|
|
|
|
|
failCount++;
|
|
|
|
|
LogAPI.Debug($"SaveJTTBData ERROR:建库成果包{dbPath} 存在质检错误。");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ResultInfo<bool> requestData = HttpHelper.PostResponse<ResultInfo<bool>>(UserLoginHelper.GetAppsetingValueByKey("ApiHost") + $"nyprocess/SubmitJKTBInfo/{dtTbbsm.Rows[i]["tbbsm"].ToString()}/{ywlx}/{userId}", JsonConvert.SerializeObject(jkResult));
|
|
|
|
|
LogAPI.Debug($"访问接口:{UserLoginHelper.GetAppsetingValueByKey("ApiHost") + $"nyprocess/SubmitJKTBInfo/{dtTbbsm.Rows[i]["tbbsm"].ToString()}/{ywlx}"}");
|
|
|
|
|
LogAPI.Debug($"参数信息:{JsonConvert.SerializeObject(jkResult)}");
|
|
|
|
|
if (requestData != null && requestData.Code == 200)
|
|
|
|
|
{
|
|
|
|
|
successCount++;
|
|
|
|
|
rdbHelper.ExecuteNonQueryWithException($"update wyrw set ZT='已上传' where tbbsm='{dtTbbsm.Rows[i]["tbbsm"].ToString()}'", CommandType.Text);
|
|
|
|
|
LogAPI.Debug($"SaveJTTBData 信息:TBBSM:{dtTbbsm.Rows[i]["tbbsm"].ToString()}数据上传成功。");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
failCount++;
|
|
|
|
|
rdbHelper.ExecuteNonQueryWithException($"update wyrw set ZT='上传失败' where tbbsm='{dtTbbsm.Rows[i]["tbbsm"].ToString()}'", CommandType.Text);
|
|
|
|
|
if (requestData != null)
|
|
|
|
|
LogAPI.Debug($"SaveJTTBData 信息:TBBSM:{dtTbbsm.Rows[i]["tbbsm"].ToString()}数据上传失败,错误信息:{requestData.Error}。");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (successCount > 0)
|
|
|
|
|
{
|
|
|
|
|
if (dtTbbsm.Rows.Count == successCount)
|
|
|
|
|
ZT = 0;
|
|
|
|
|
else
|
|
|
|
|
ZT = 1;
|
|
|
|
|
result.Data = true;
|
|
|
|
|
result.Code = 200;
|
|
|
|
|
result.Message = $"变更范围图斑共计{dtTbbsm.Rows.Count}个,成功上传{successCount}个,失败{failCount}个。";
|
|
|
|
|
}
|
|
|
|
|
else if (failCount > 0)
|
|
|
|
|
{
|
|
|
|
|
ZT = 2;
|
|
|
|
|
result.Data = false;
|
|
|
|
|
result.Code = 500;
|
|
|
|
|
result.Error = "建库成果包存在质检错误。";
|
|
|
|
|
result.Message = $"变更范围图斑共计{dtTbbsm.Rows.Count}个,成功上传{successCount}个,失败{failCount}个。";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
result.Error = "建库成果包未检测到变更范围数据。";
|
|
|
|
|
LogAPI.Debug($"SaveJTTBData ERROR:建库成果包{dbPath}未检测到变更范围数据。");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
ZT = 2;
|
|
|
|
|
result.Data = false;
|
|
|
|
|
result.Code = 500;
|
|
|
|
|
result.Error = e.Message;
|
|
|
|
|
LogAPI.Debug($"SaveJTTBData ERROR:建库成果包{dbPath}" + e.Message);
|
|
|
|
|
LogAPI.Debug($"SaveJTTBData ERROR:建库成果包{dbPath}" + e.StackTrace);
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
if (dt != null)
|
|
|
|
|
{
|
|
|
|
|
dt.Clear();
|
|
|
|
|
dt.Dispose();
|
|
|
|
|
}
|
|
|
|
|
if (dtTbbsm != null)
|
|
|
|
|
{
|
|
|
|
|
dtTbbsm.Clear();
|
|
|
|
|
dtTbbsm.Dispose();
|
|
|
|
|
}
|
|
|
|
|
if (rdbHelper.State == System.Data.ConnectionState.Open)
|
|
|
|
|
{
|
|
|
|
|
rdbHelper.DisConnect();
|
|
|
|
|
rdbHelper.Clear();
|
|
|
|
|
}
|
|
|
|
|
rdbHelper = null;
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ResultInfo<bool> SaveJTTBData(string dbPath, string ywlx, string userId, string tbbsmInTaskPackage)
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(dbPath) || !System.IO.File.Exists(dbPath))
|
|
|
|
|
{
|
|
|
|
|
MessageHelper.Show("此任务包为空或者在图斑操作完成之后才允许上传!");
|
|
|
|
|
LogAPI.Debug("此任务包为空或者在图斑操作完成之后才允许上传!");
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
ResultInfo<bool> result = new ResultInfo<bool>();
|
|
|
|
|
JKTBDataInfo jkResult = new JKTBDataInfo();
|
|
|
|
|
jkResult.WYRW = new List<WYRWItem>();
|
|
|
|
|
jkResult.DTBDLTBGX = new List<DTBDLTBGXItem>();
|
|
|
|
|
jkResult.DTBDLTBGXGC = new List<DTBDLTBGXGCItem>();
|
|
|
|
|
jkResult.DTBLSYDGX = new List<DTBLSYDGXItem>();
|
|
|
|
|
jkResult.DTBGFBQGX = new List<DTBGFBQGXItem>();
|
|
|
|
|
jkResult.DTBTTQGX = new List<DTBTTQGXItem>();
|
|
|
|
|
jkResult.DTBLMFWGX = new List<DTBLMFWGXItem>();
|
|
|
|
|
jkResult.DTBCCWJQGX = new List<DTBCCWJQGXItem>();
|
|
|
|
|
jkResult.DTBCZCDYDGX = new List<DTBCZCDYDGXItem>();
|
|
|
|
|
jkResult.WYHCFJ = new List<WYHCFJItem>();
|
|
|
|
|
jkResult.FJGX = new List<FJGXItem>();
|
|
|
|
|
jkResult.RGFL = new List<RGFLItem>();
|
|
|
|
|
//dbPath = UserLoginHelper.GetAppsetingValueByKey("JkTaskDBName");
|
|
|
|
|
IRDBHelper rdbHelper = null;
|
|
|
|
|
string strSql = string.Empty, strResult = string.Empty;
|
|
|
|
|
DataTable dt = null, dtTbbsm = null, dtWyrwZT = null;
|
|
|
|
|
int successCount = 0, failCount = 0;
|
|
|
|
|
string EGeometry = string.Empty;
|
|
|
|
|
string wyrwZT = string.Empty;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
rdbHelper = RDBFactory.CreateDbHelper($"{dbPath}{(MapsManager.Instance.CurrProjectInfo as ProjectInfo).Pathpassword}", DatabaseType.SQLite);
|
|
|
|
|
strSql = $"select distinct tbbsm from dtbdltbgx where tbbsm in ({tbbsmInTaskPackage})";
|
|
|
|
|
dtTbbsm = rdbHelper.ExecuteDatatable("dtbdltbgx", strSql, true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (dtTbbsm != null && dtTbbsm.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < dtTbbsm.Rows.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
//查询 DTBDLTBGX
|
|
|
|
|
strSql = $"select bsm,tbbsm,tbybh,dlbm,dlmc,tbmj,kcdlbm,tbdlmj,gdlx,xzdwkd,tbxhdm,tbxhmc,zzsxdm,zzsxmc,czcsxm,bz,EGeometry,gxsj,tblx,sfgx,wbgyy,sfjz,qksm,ljlx,maxx,maxy,minx,miny,ywtbsm,shlzqksm,nbwqksm,sdmssm,ydyhfl,czctbbh,qsxz,qsdwdm,qsdwmc,zldwdm,zldwmc,sjnf,ddtcbz,ddtcmc,ljbz,jzybh,ljtbbh,gddb,gdpdjb,zzzw from dtbdltbgx where tbbsm = '{dtTbbsm.Rows[i]["tbbsm"].ToString()}'";
|
|
|
|
|
dt = rdbHelper.ExecuteDatatable("dtbdltbgx", strSql, true);
|
|
|
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
jkResult.DTBDLTBGX = KGIS.Framework.Utils.Utility.TBToList.ToList<DTBDLTBGXItem>(dt);
|
|
|
|
|
foreach (DataRow row in dt.Rows)
|
|
|
|
|
{
|
|
|
|
|
RGFLItem rgfl = new RGFLItem();
|
|
|
|
|
WLHRGChecker check = new WLHRGChecker(row["bsm"].ToString(), dbPath, null);
|
|
|
|
|
rgfl.bgfwbsm = row["bsm"].ToString();
|
|
|
|
|
rgfl.rgrule = check.CheckDL();
|
|
|
|
|
jkResult.RGFL.Add(rgfl);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//查询 DTBDLTBGXGC
|
|
|
|
|
strSql = $"select bsm, tbbsm, bgxw, xzqtzlx, tbbgmj, bgqbsm, bgqtbbh, bgqdlbm, bgqdlmc, bgqqsxz, bgqqsdwdm, bgqqsdwmc, bgqzldwdm, bgqzldwmc, bgqkcdlbm, bgqkcxs, bgqkcmj, bgqtbdlmj, bgqgdlx, bgqgdpdjb, bgqxzdwkd, bgqtbxhdm, bgqtbxhmc, bgqzzsxdm, bgqzzsxmc, bgqgddb, bgqfrdbs, bgqczcsxm, bgqmssm, bgqhdmc, bghtbbsm, bghtbbh, bghdlbm, bghdlmc, bghqsxz, bghqsdwdm, bghqsdwmc, bghzldwdm, bghzldwmc, bghkcdlbm, bghkcxs, bghkcmj, bghtbdlmj, bghgdlx, bghgdpdjb, bghxzdwkd, bghtbxhdm, bghtbxhmc, bghzzsxdm, bghzzsxmc, bghgddb, bghfrdbs, bghczcsxm, bghmssm, bghhdmc, gxsj,EGeometry from DTBDLTBGXGC where tbbsm = '{dtTbbsm.Rows[i]["tbbsm"].ToString()}'";
|
|
|
|
|
if (dt != null)
|
|
|
|
|
{
|
|
|
|
|
dt.Clear();
|
|
|
|
|
dt = null;
|
|
|
|
|
}
|
|
|
|
|
dt = rdbHelper.ExecuteDatatable("DTBDLTBGXGC", strSql, true);
|
|
|
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
jkResult.DTBDLTBGXGC = KGIS.Framework.Utils.Utility.TBToList.ToList<DTBDLTBGXGCItem>(dt);
|
|
|
|
|
}
|
|
|
|
|
//查询 DTBLSYDGX
|
|
|
|
|
strSql = $"SELECT A.BSM, A.DDTCBZ, A.DDTCMC, A.YSDM, A.GLTBBSM, A.PZWJMC, A.PZWH, A.TBMJ, A.PZMJ, A.YTFL, A.JTXMYT, A.PZRQ, A.YQSX, A.TDSYHT, A.BZ, A.GXSJ,B.EGeometry FROM DTBLSYDGX A left join DTBDLTBGX B on A.BSM = b.BSM where A.bsm in (select bsm from DTBDLTBGX where tbbsm = '{ dtTbbsm.Rows[i]["tbbsm"].ToString()}') ";
|
|
|
|
|
if (dt != null)
|
|
|
|
|
{
|
|
|
|
|
dt.Clear();
|
|
|
|
|
dt = null;
|
|
|
|
|
}
|
|
|
|
|
dt = rdbHelper.ExecuteDatatable("DTBLSYDGX", strSql, true);
|
|
|
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
jkResult.DTBLSYDGX = KGIS.Framework.Utils.Utility.TBToList.ToList<DTBLSYDGXItem>(dt);
|
|
|
|
|
}
|
|
|
|
|
//查询 DTBGFBQGX
|
|
|
|
|
strSql = $"SELECT A.BSM, A.DDTCBZ, A.DDTCMC, A.YSDM, A.XMMC, A.XMGM, A.QYMJ, A.PZYDSJ, A.BZ, A.GXSJ,B.EGeometry FROM DTBGFBQGX A left join DTBDLTBGX B on A.BSM = b.BSM where A.bsm in ( select bsm from DTBDLTBGX where tbbsm = '{ dtTbbsm.Rows[i]["tbbsm"].ToString()}' )";
|
|
|
|
|
if (dt != null)
|
|
|
|
|
{
|
|
|
|
|
dt.Clear();
|
|
|
|
|
dt = null;
|
|
|
|
|
}
|
|
|
|
|
dt = rdbHelper.ExecuteDatatable("DTBGFBQGX", strSql, true);
|
|
|
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
jkResult.DTBGFBQGX = KGIS.Framework.Utils.Utility.TBToList.ToList<DTBGFBQGXItem>(dt);
|
|
|
|
|
}
|
|
|
|
|
//查询 DTBTTQGX
|
|
|
|
|
strSql = $"SELECT A.BSM, A.DDTCBZ, A.DDTCMC, A.YSDM, A.TTQMJ, A.BZ, A.GXSJ ,B.EGeometry FROM DTBTTQGX A left join DTBDLTBGX B on A.BSM = b.BSM where A.bsm in (select bsm from DTBDLTBGX where tbbsm = '{ dtTbbsm.Rows[i]["tbbsm"].ToString()}')";
|
|
|
|
|
if (dt != null)
|
|
|
|
|
{
|
|
|
|
|
dt.Clear();
|
|
|
|
|
dt = null;
|
|
|
|
|
}
|
|
|
|
|
dt = rdbHelper.ExecuteDatatable("DTBTTQGX", strSql, true);
|
|
|
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
jkResult.DTBTTQGX = KGIS.Framework.Utils.Utility.TBToList.ToList<DTBTTQGXItem>(dt);
|
|
|
|
|
}
|
|
|
|
|
//查询 DTBLMFWGX
|
|
|
|
|
strSql = $"SELECT A.BSM, A.DDTCBZ, A.DDTCMC, A.YSDM, A.ZLDWDM, A.KD, A.MJ, A.DLBM, A.MC, A.BZ, A.GXSJ ,B.EGeometry FROM DTBLMFWGX A left join DTBDLTBGX B on A.BSM = b.BSM where A.bsm in (select bsm from DTBDLTBGX where tbbsm = '{ dtTbbsm.Rows[i]["tbbsm"].ToString()}') ";
|
|
|
|
|
if (dt != null)
|
|
|
|
|
{
|
|
|
|
|
dt.Clear();
|
|
|
|
|
dt = null;
|
|
|
|
|
}
|
|
|
|
|
dt = rdbHelper.ExecuteDatatable("DTBLMFWGX", strSql, true);
|
|
|
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
jkResult.DTBLMFWGX = KGIS.Framework.Utils.Utility.TBToList.ToList<DTBLMFWGXItem>(dt);
|
|
|
|
|
}
|
|
|
|
|
//查询 DTBCCWJQGX
|
|
|
|
|
strSql = $" SELECT A.BSM, A.DDTCBZ, A.DDTCMC, A.YSDM, A.ZDMJ, A.BZ, A.GXSJ,B.EGeometry FROM DTBCCWJQGX A left join DTBDLTBGX B on A.BSM = b.BSM where A.bsm in (select bsm from DTBDLTBGX where tbbsm = '{ dtTbbsm.Rows[i]["tbbsm"].ToString()}') ";
|
|
|
|
|
if (dt != null)
|
|
|
|
|
{
|
|
|
|
|
dt.Clear();
|
|
|
|
|
dt = null;
|
|
|
|
|
}
|
|
|
|
|
dt = rdbHelper.ExecuteDatatable("DTBCCWJQGX", strSql, true);
|
|
|
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
jkResult.DTBCCWJQGX = KGIS.Framework.Utils.Utility.TBToList.ToList<DTBCCWJQGXItem>(dt);
|
|
|
|
|
}
|
|
|
|
|
//查询 DTBCZCDYDGX
|
|
|
|
|
strSql = $" SELECT A.BSM, A.DDTCBZ, A.DDTCMC, A.YSDM, A.CZCLX, A.CZCDM, A.CZCMC, A.CZCMJ, A.BZ, A.GXSJ,B.EGeometry FROM DTBCZCDYDGX A left join DTBDLTBGX B on A.BSM = b.BSM where A.bsm in (select bsm from DTBDLTBGX where tbbsm = '{ dtTbbsm.Rows[i]["tbbsm"].ToString()}') ";
|
|
|
|
|
if (dt != null)
|
|
|
|
|
{
|
|
|
|
|
dt.Clear();
|
|
|
|
|
dt = null;
|
|
|
|
|
}
|
|
|
|
|
dt = rdbHelper.ExecuteDatatable("DTBCZCDYDGX", strSql, true);
|
|
|
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
jkResult.DTBCZCDYDGX = KGIS.Framework.Utils.Utility.TBToList.ToList<DTBCZCDYDGXItem>(dt);
|
|
|
|
|
}
|
|
|
|
|
//查询 FJGX
|
|
|
|
|
strSql = $"SELECT WYTBBSM, FJARG, TBBSM FROM FJGX WHERE WYTBBSM = '{dtTbbsm.Rows[i]["tbbsm"].ToString()}'";
|
|
|
|
|
if (dt != null)
|
|
|
|
|
{
|
|
|
|
|
dt.Clear();
|
|
|
|
|
dt = null;
|
|
|
|
|
}
|
|
|
|
|
dt = rdbHelper.ExecuteDatatable("FJGX", strSql, true);
|
|
|
|
|
|
|
|
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
jkResult.FJGX = KGIS.Framework.Utils.Utility.TBToList.ToList<FJGXItem>(dt);
|
|
|
|
|
}
|
|
|
|
|
//查询 WYRW
|
|
|
|
|
strSql = $"SELECT TBBSM, XZQDM, XZDM, JCBH, SJLY, JCMJ, TBMJ, Geometry, EGeometry, ZXDX, ZXDY, MAXX, MAXY, MINX, MINY FROM WYRW WHERE TBBSM = '{dtTbbsm.Rows[i]["tbbsm"].ToString()}'";
|
|
|
|
|
if (dt != null)
|
|
|
|
|
{
|
|
|
|
|
dt.Clear();
|
|
|
|
|
dt = null;
|
|
|
|
|
}
|
|
|
|
|
dt = rdbHelper.ExecuteDatatable("WYRW", strSql, true);
|
|
|
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
jkResult.WYRW = KGIS.Framework.Utils.Utility.TBToList.ToList<WYRWItem>(dt);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//没有填图层信息与地类编码的任务不允许上传
|
|
|
|
|
if (CheckSXIsNull(dtTbbsm.Rows[i]["tbbsm"].ToString(), rdbHelper))
|
|
|
|
|
{
|
|
|
|
|
failCount++;
|
|
|
|
|
//MessageHelper.Show("未填图层信息与地类编码的任务不允许上传!");
|
|
|
|
|
LogAPI.Debug($"SaveJTTBData ERROR:建库成果包{dbPath} TBBSM:{dtTbbsm.Rows[i]["tbbsm"].ToString()} 未填图层信息与地类编码的任务不允许上传。");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!CheckErrorResult(dtTbbsm.Rows[i]["tbbsm"].ToString(), rdbHelper))
|
|
|
|
|
{
|
|
|
|
|
failCount++;
|
|
|
|
|
LogAPI.Debug($"SaveJTTBData ERROR:建库成果包{dbPath} TBBSM:{dtTbbsm.Rows[i]["tbbsm"].ToString()} 存在质检错误。");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ResultInfo<bool> requestData = HttpHelper.PostResponse<ResultInfo<bool>>(UserLoginHelper.GetAppsetingValueByKey("ApiHost") + $"nyprocess/SubmitJKTBInfo/{dtTbbsm.Rows[i]["tbbsm"].ToString()}/{ywlx}/{userId}", JsonConvert.SerializeObject(jkResult));
|
|
|
|
|
//LogAPI.Debug($"访问接口:{UserLoginHelper.GetAppsetingValueByKey("ApiHost") + $"nyprocess/SubmitJKTBInfo/{dtTbbsm.Rows[i]["tbbsm"].ToString()}/{ywlx}"}");
|
|
|
|
|
//LogAPI.Debug($"参数信息:{JsonConvert.SerializeObject(jkResult)}");
|
|
|
|
|
string ZT = "";
|
|
|
|
|
if (requestData != null && requestData.Code == 200)
|
|
|
|
|
{
|
|
|
|
|
successCount++;
|
|
|
|
|
ZT = "已上传";
|
|
|
|
|
rdbHelper.ExecuteNonQueryWithException($"update wyrw set ZT='已上传' where tbbsm='{dtTbbsm.Rows[i]["tbbsm"].ToString()}'", CommandType.Text);
|
|
|
|
|
LogAPI.Debug($"SaveJTTBData 信息:TBBSM:{dtTbbsm.Rows[i]["tbbsm"].ToString()}数据上传成功。");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
failCount++;
|
|
|
|
|
|
|
|
|
|
//已上传过的图斑状态不更新
|
|
|
|
|
#region
|
|
|
|
|
dtWyrwZT = null;
|
|
|
|
|
dtWyrwZT = rdbHelper.ExecuteDatatable("wyrw", $"select distinct tbbsm, ZT from wyrw where tbbsm='{dtTbbsm.Rows[i]["tbbsm"].ToString()}'", true);
|
|
|
|
|
if (dtWyrwZT != null && dtWyrwZT.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
if (dtWyrwZT.Rows[0]["ZT"].ToString() != "已上传")
|
|
|
|
|
{
|
|
|
|
|
ZT = "上传失败";
|
|
|
|
|
rdbHelper.ExecuteNonQueryWithException($"update wyrw set ZT='上传失败' where tbbsm='{dtTbbsm.Rows[i]["tbbsm"].ToString()}'", CommandType.Text);
|
|
|
|
|
if (requestData != null)
|
|
|
|
|
LogAPI.Debug($"SaveJTTBData 信息:TBBSM:{dtTbbsm.Rows[i]["tbbsm"].ToString()}数据上传失败,错误信息:{requestData.Error}。");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ZT = "上传失败";
|
|
|
|
|
rdbHelper.ExecuteNonQueryWithException($"update wyrw set ZT='上传失败' where tbbsm='{dtTbbsm.Rows[i]["tbbsm"].ToString()}'", CommandType.Text);
|
|
|
|
|
if (requestData != null)
|
|
|
|
|
LogAPI.Debug($"SaveJTTBData 信息:TBBSM:{dtTbbsm.Rows[i]["tbbsm"].ToString()}数据上传失败,错误信息:{requestData.Error}。");
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//修改任务树节点状态
|
|
|
|
|
Platform.Instance.SendMsg(new KGIS.Framework.Utils.Interface.NotifyMsgPackage() { MsgType = "RefreshPackageTreeNode", Content = dtTbbsm.Rows[i]["tbbsm"].ToString() + "&" + ZT });
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (successCount > 0)
|
|
|
|
|
{
|
|
|
|
|
result.Data = true;
|
|
|
|
|
result.Code = 200;
|
|
|
|
|
result.SuccessCount = successCount;
|
|
|
|
|
result.FailCount = failCount;
|
|
|
|
|
result.Message = $"变更范围图斑共计{dtTbbsm.Rows.Count}个,成功上传{successCount}个,失败{failCount}个。";
|
|
|
|
|
}
|
|
|
|
|
else if (failCount > 0)
|
|
|
|
|
{
|
|
|
|
|
result.Data = false;
|
|
|
|
|
result.Code = 500;
|
|
|
|
|
result.SuccessCount = successCount;
|
|
|
|
|
result.FailCount = failCount;
|
|
|
|
|
result.Error = "建库成果包存在质检错误或者此图斑不允许上传,请查看日志或联系客服。";
|
|
|
|
|
result.Message = $"变更范围图斑共计{dtTbbsm.Rows.Count}个,成功上传{successCount}个,失败{failCount}个。";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
result.SuccessCount = successCount;
|
|
|
|
|
result.FailCount = failCount;
|
|
|
|
|
result.Error = "建库成果包未检测到变更范围数据。";
|
|
|
|
|
LogAPI.Debug($"SaveJTTBData ERROR:建库成果包{dbPath}未检测到变更范围数据。");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
result.Data = false;
|
|
|
|
|
result.Code = 500;
|
|
|
|
|
result.SuccessCount = successCount;
|
|
|
|
|
result.FailCount = failCount;
|
|
|
|
|
result.Error = e.Message;
|
|
|
|
|
LogAPI.Debug($"SaveJTTBData ERROR:建库成果包{dbPath}" + e.Message);
|
|
|
|
|
LogAPI.Debug($"SaveJTTBData ERROR:建库成果包{dbPath}" + e.StackTrace);
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
if (dt != null)
|
|
|
|
|
{
|
|
|
|
|
dt.Clear();
|
|
|
|
|
dt.Dispose();
|
|
|
|
|
}
|
|
|
|
|
if (dtTbbsm != null)
|
|
|
|
|
{
|
|
|
|
|
dtTbbsm.Clear();
|
|
|
|
|
dtTbbsm.Dispose();
|
|
|
|
|
}
|
|
|
|
|
if (dtWyrwZT != null)
|
|
|
|
|
{
|
|
|
|
|
dtWyrwZT.Clear();
|
|
|
|
|
dtWyrwZT.Dispose();
|
|
|
|
|
}
|
|
|
|
|
if (rdbHelper.State == System.Data.ConnectionState.Open)
|
|
|
|
|
{
|
|
|
|
|
rdbHelper.DisConnect();
|
|
|
|
|
rdbHelper.Clear();
|
|
|
|
|
}
|
|
|
|
|
rdbHelper = null;
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 改变任务图斑生命周期
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="ywlx"></param>
|
|
|
|
|
/// <param name="tbbsm"></param>
|
|
|
|
|
/// <param name="workerid"></param>
|
|
|
|
|
/// <param name="lifecycle"></param>
|
|
|
|
|
/// <param name="oldlifecycle"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public bool UpdateTBLifecycle(string ywlx, string tbbsm, int workerid, int lifecycle, int oldlifecycle)
|
|
|
|
|
{
|
|
|
|
|
bool b = false;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var requestParam = new
|
|
|
|
|
{
|
|
|
|
|
ywname = ywlx,
|
|
|
|
|
tbbsm = tbbsm,
|
|
|
|
|
workerid = workerid,
|
|
|
|
|
lifecycle = lifecycle,
|
|
|
|
|
oldlifecycle = oldlifecycle
|
|
|
|
|
};
|
|
|
|
|
ResultInfo<bool> requestData = HttpHelper.PostResponse<ResultInfo<bool>>(UserLoginHelper.GetAppsetingValueByKey("ApiHost") + "nyprocess/UpdateTBLifecycle", requestParam);
|
|
|
|
|
if (requestData != null && requestData.Code == 200)
|
|
|
|
|
{
|
|
|
|
|
b = requestData.Data;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ee)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug(ee);
|
|
|
|
|
}
|
|
|
|
|
return b;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取行政区代码列表
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="ywlx"></param>
|
|
|
|
|
/// <param name="workerid"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public List<XZQDMInfo> GetGetBuiltNumber(string ywlx, int workerid)
|
|
|
|
|
{
|
|
|
|
|
List<XZQDMInfo> jktbData = null;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
string url = $"{UserLoginHelper.GetAppsetingValueByKey("ApiHost")}nyprocess/GetBuiltNumber/{ywlx}/{workerid}";
|
|
|
|
|
ResultInfo<List<XZQDMInfo>> requestData = HttpHelper.GetResponse<ResultInfo<List<XZQDMInfo>>>(url);
|
|
|
|
|
if (requestData != null && requestData.Code == 200)
|
|
|
|
|
{
|
|
|
|
|
jktbData = requestData.Data;
|
|
|
|
|
}
|
|
|
|
|
if (jktbData == null)
|
|
|
|
|
{
|
|
|
|
|
throw (new Exception("获取行政区代码失败!"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug("获取行政区代码失败:" + ex);
|
|
|
|
|
}
|
|
|
|
|
return jktbData;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 质检-外业任务图斑
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="tbbsm"></param>
|
|
|
|
|
/// <param name="dbPath"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
private bool DTBCheckPackage(string tbbsm, string dbPath)
|
|
|
|
|
{
|
|
|
|
|
bool ZTIsUploaded = false;
|
|
|
|
|
bool b = false;
|
|
|
|
|
IRDBHelper rdbHelper = null;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
rdbHelper = RDBFactory.CreateDbHelper($"{dbPath}{(MapsManager.Instance.CurrProjectInfo as ProjectInfo).Pathpassword}", DatabaseType.SQLite);
|
|
|
|
|
|
|
|
|
|
//已上传状态
|
|
|
|
|
ZTIsUploaded = DTBDBLoadHelper.JudgeZTIsUploaded(rdbHelper, tbbsm);
|
|
|
|
|
|
|
|
|
|
List<Kingo.RuleCheck.RuleEntity> lstResult = new List<Kingo.RuleCheck.RuleEntity>();
|
|
|
|
|
//去除冗余数据
|
|
|
|
|
rdbHelper.ExecuteNonQueryWithException("delete from FJGX where tbbsm not in(select bsm from DTBDLTBGX);", CommandType.Text);
|
|
|
|
|
rdbHelper.ExecuteNonQueryWithException("delete from DTBDLTBGXGC where bghtbbsm not in(select bsm from DTBDLTBGX);", CommandType.Text);
|
|
|
|
|
rdbHelper.ExecuteNonQueryWithException("delete from DTBLSYDGX where bsm not in(select bsm from DTBDLTBGX);", CommandType.Text);
|
|
|
|
|
rdbHelper.ExecuteNonQueryWithException("delete from DTBTTQGX where bsm not in(select bsm from DTBDLTBGX);", CommandType.Text);
|
|
|
|
|
rdbHelper.ExecuteNonQueryWithException("delete from DTBGFBQGX where bsm not in(select bsm from DTBDLTBGX);", CommandType.Text);
|
|
|
|
|
rdbHelper.ExecuteNonQueryWithException("delete from DTBCCWJQGX where bsm not in(select bsm from DTBDLTBGX);", CommandType.Text);
|
|
|
|
|
rdbHelper.ExecuteNonQueryWithException("delete from DTBCZCDYDGX where bsm not in(select bsm from DTBDLTBGX);", CommandType.Text);
|
|
|
|
|
rdbHelper.ExecuteNonQueryWithException("delete from DTBLMFWGX where bsm not in(select bsm from DTBDLTBGX);", CommandType.Text);
|
|
|
|
|
rdbHelper.ExecuteNonQueryWithException("delete from checkresult where tbbsm in(select TBBSM from wyrw where FWY=1);", CommandType.Text);
|
|
|
|
|
|
|
|
|
|
//返外业的不检查
|
|
|
|
|
DataTable dataTable = rdbHelper.ExecuteDatatable("data", $"select TBBSM from wyrw where TBBSM='{tbbsm}' AND FWY=1", true);
|
|
|
|
|
if (dataTable != null && dataTable.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
return b;
|
|
|
|
|
}
|
|
|
|
|
rdbHelper.ExecuteNonQueryWithException($"delete from checkresult where tbbsm='{tbbsm}';", CommandType.Text);
|
|
|
|
|
//判断当前外业任务图斑下是否存在变更图斑
|
|
|
|
|
dataTable = rdbHelper.ExecuteDatatable("data", $"select TBBSM from dtbdltbgx where TBBSM='{tbbsm}'", true);
|
|
|
|
|
if (dataTable == null || dataTable.Rows.Count <= 0)
|
|
|
|
|
{
|
|
|
|
|
lstResult.Add(new RuleCheck.RuleEntity() { ErrorId = tbbsm, ErrorTip = "当前外业图斑下不存在变更图斑!", RuleContent = "当前外业图斑下不存在变更图斑", ErrorType = "一类错误" });
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
lstResult = RuleCheck.XJRuleCheck.RuleCheckOpertion_DTB.StartXJSHCheck(tbbsm, dbPath, DTBDBLoadHelper.GetBasicData());
|
|
|
|
|
}
|
|
|
|
|
if (lstResult != null && lstResult.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
string excuteSQL = "INSERT INTO CheckResult (XH, CheckObject, ErrorType, ErrorId, ErrorTip,RuleCode, RuleName, RuleContent,TBBSM,GeometryType,Geometry) VALUES({0}, '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}','{8}', {9},'{10}');";
|
|
|
|
|
int i = 1;
|
|
|
|
|
lstResult.OrderBy(X => X.ErrorId);
|
|
|
|
|
foreach (var item in lstResult)
|
|
|
|
|
{
|
|
|
|
|
item.XH = i++;
|
|
|
|
|
rdbHelper.ExecuteNonQueryWithException(string.Format(excuteSQL, item.XH, item.CheckObject, item.ErrorType, item.ErrorId, item.ErrorTip, item.RuleCode, item.RuleName, item.RuleContent, tbbsm, item.GeometryType, item.Geometry), CommandType.Text);
|
|
|
|
|
}
|
|
|
|
|
if (!ZTIsUploaded)
|
|
|
|
|
rdbHelper.ExecuteNonQueryWithException($"update wyrw set ZT='质检错误' where tbbsm='{tbbsm}'", CommandType.Text);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (!ZTIsUploaded)
|
|
|
|
|
rdbHelper.ExecuteNonQueryWithException($"update wyrw set ZT='已完成' where tbbsm='{tbbsm}'", CommandType.Text);
|
|
|
|
|
b = true;
|
|
|
|
|
}
|
|
|
|
|
//rdbHelper.Commit();
|
|
|
|
|
return b;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
if (rdbHelper != null)
|
|
|
|
|
{
|
|
|
|
|
if (!ZTIsUploaded)
|
|
|
|
|
rdbHelper.ExecuteNonQueryWithException($"update wyrw set ZT='质检错误' where tbbsm='{tbbsm}'", CommandType.Text);
|
|
|
|
|
}
|
|
|
|
|
LogAPI.Debug(ex);
|
|
|
|
|
throw ex;
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
if (rdbHelper != null)
|
|
|
|
|
{
|
|
|
|
|
rdbHelper.DisConnect();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 判断是否有质检错误
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="tbbsm"></param>
|
|
|
|
|
/// <param name="dbPath"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
private bool CheckErrorResult(string tbbsm, IRDBHelper rdbHelper)
|
|
|
|
|
{
|
|
|
|
|
if(rdbHelper == null) return false;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
List<Kingo.RuleCheck.RuleEntity> lstResult = new List<Kingo.RuleCheck.RuleEntity>();
|
|
|
|
|
rdbHelper.ExecuteNonQueryWithException("delete from checkresult where tbbsm in(select TBBSM from wyrw where FWY=1);", CommandType.Text);
|
|
|
|
|
|
|
|
|
|
//返外业的不检查
|
|
|
|
|
DataTable dataTable = rdbHelper.ExecuteDatatable("data", $"select TBBSM from wyrw where TBBSM='{tbbsm}' AND FWY=1", true);
|
|
|
|
|
if (dataTable != null && dataTable.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dataTable = rdbHelper.ExecuteDatatable("data", $"select * from checkresult where TBBSM='{tbbsm}' ", true);
|
|
|
|
|
if (dataTable != null && dataTable.Rows.Count > 0)
|
|
|
|
|
return false;
|
|
|
|
|
else
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug(ex);
|
|
|
|
|
throw ex;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private bool CheckSXIsNull(string tbbsm, IRDBHelper rdbHelper)
|
|
|
|
|
{
|
|
|
|
|
if(rdbHelper == null) return false;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
DataTable dataTable = rdbHelper.ExecuteDatatable("data", $"select ddtcbz, dlbm from dtbdltbgx where TBBSM='{tbbsm}' ", true);
|
|
|
|
|
if (dataTable != null && dataTable.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
foreach (DataRow row in dataTable.Rows)
|
|
|
|
|
{
|
|
|
|
|
if(string.IsNullOrEmpty(row["ddtcbz"].ToString()) || string.IsNullOrEmpty(row["dlbm"].ToString()))
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug(ex);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|