| | |
| | | string txtFile = null; |
| | | try |
| | | { |
| | | txtFile = Path.Combine(Tools.TempDir, ExportUtil.DateStr + ".txt"); |
| | | string dirPath = GetTerrainPath(args.dircode); |
| | | if (!Directory.Exists(dirPath)) Directory.CreateDirectory(dirPath); |
| | | |
| | | txtFile = Path.Combine(Tools.TempDir, ExportUtil.DateStr + ".txt"); |
| | | string tifFile = Path.Combine(dirPath, args.dircode + ".tif"); |
| | | //if (File.Exists(tifFile)) File.Delete(tifFile); |
| | | |
| | | WriteText(txtFile, metas); |
| | | int pubid = PubDBHelper.GetPushlishId(args.dircode, "DEM"); |
| | | if (pubid > 0 && File.Exists(tifFile)) |
| | | { |
| | | List<int> ids = PubDBHelper.GetPublishMetaId(pubid); |
| | | |
| | | List<SysMeta> news = new List<SysMeta>(); |
| | | foreach (SysMeta m in metas) |
| | | { |
| | | if (!ids.Contains(m.id)) news.Add(m); |
| | | } |
| | | if (0 == news.Count) return tifFile; |
| | | |
| | | string oldTif = Path.Combine(dirPath, args.dircode + "_old.tif"); |
| | | if (File.Exists(oldTif)) File.Delete(oldTif); |
| | | File.Move(tifFile, oldTif); |
| | | WriteText(txtFile, news, oldTif); |
| | | } |
| | | else |
| | | { |
| | | if (File.Exists(tifFile)) File.Delete(tifFile); |
| | | WriteText(txtFile, metas, null); |
| | | } |
| | | |
| | | string cmd = string.Format("python \"{0}\" -qgz {1} -file \"{2}\" -out \"{3}\"", PyFile, Qgz, txtFile, tifFile); |
| | | err = Tools.ExecCmd(cmd, true, false); |
| | |
| | | finally |
| | | { |
| | | if (!string.IsNullOrEmpty(txtFile) && File.Exists(txtFile)) File.Delete(txtFile); |
| | | |
| | | string dirPath = GetTerrainPath(args.dircode); |
| | | string tifFile = Path.Combine(dirPath, args.dircode + ".tif"); |
| | | string oldTif = Path.Combine(dirPath, args.dircode + "_old.tif"); |
| | | if (File.Exists(tifFile) && File.Exists(oldTif)) File.Delete(oldTif); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 写文本文件 |
| | | /// </summary> |
| | | private static void WriteText(string txtFile, List<SysMeta> list) |
| | | private static void WriteText(string txtFile, List<SysMeta> list, string tif) |
| | | { |
| | | string uploadFolder = Tools.GetSetting("uploadFolder"); |
| | | |
| | | List<string> files = new List<string>(); |
| | | if (!string.IsNullOrEmpty(tif)) files.Add(tif); |
| | | foreach (SysMeta meta in list) |
| | | { |
| | | string filePath = Path.Combine(uploadFolder, meta.path); |
| | | if (File.Exists(filePath)) files.Add(filePath); |
| | | } |
| | | string str = string.Join("\r\n", files); |
| | | |
| | | string str = string.Join("\r\n", files); |
| | | File.WriteAllText(txtFile, str); |
| | | } |
| | | |
| | |
| | | { |
| | | if (!ids.Contains(m.id)) PubDBHelper.InsertMetaPub(m.id, pubid, args.userId); |
| | | } |
| | | string json = GetPointZ(args); |
| | | if (!string.IsNullOrEmpty(json)) PubDBHelper.UpdatePublishCoord(pubid, json); |
| | | |
| | | return pubid; |
| | | } |
| | | |
| | |
| | | /// </summary> |
| | | public static int UpdatePublishCoord(int pid, string json) |
| | | { |
| | | string sql = string.Format("update lf.sys_publish set json = '{0}' where id = {1}", json, pid); |
| | | string sql = string.Format("update lf.sys_publish set json = @json where id = {0}", pid); |
| | | DbParameter dp = new NpgsqlParameter("@json", json); |
| | | |
| | | return Tools.DBHelper.ExecuteNonQuery(sql); |
| | | return Tools.DBHelper.ExecuteNonQuery(sql, dp); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
| | | <script src="js/jquery.1.12.4.js"></script> |
| | | <script> |
| | | var token = "0de31b49-1957-4e15-8258-965a35ea56cb"; |
| | | var token = "5f98316d-de91-4850-a20f-44080a278115"; |
| | | |
| | | // Ajax |
| | | function ajax(url, type, data, dataType, contentType, fn) { |
| | |
| | | |
| | | // 测试Terra:10526,10527 |
| | | function toTerra() { |
| | | var data = { token: token, ids: [10526], min: 0, max: 18, depcode: "00", dircode: "09", userId: 1, name: "BN_GD" }; |
| | | var data = { token: token, ids: [10526, 10527], min: 0, max: 18, depcode: "00", dircode: "09", userId: 1, name: "BN_GD" }; |
| | | ajax("Convert/ToTerra", "POST", JSON.stringify(data), null, null, function (rs) { |
| | | alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); |
| | | console.log(rs); |