管道基础大数据平台系统开发-【CS】-ExportMap
13693261870
2024-09-07 8d7a67ab1d635cb954337d8a767878ae526dd3dc
ExportMap/cs/TBUtils.cs
@@ -49,7 +49,6 @@
        public static string CreateMpt(string sourcePath, ref string err)
        {
            string time = TimeStr;
            try
            {
                if (isBusy) throw new Exception("已有一个生成Mpt的任务正在执行");
@@ -62,9 +61,10 @@
                string tbp = GetNewTbp(time);
                string js = GetNewJs(time, tbp, targetPath);
                string cmd = string.Format("\"C:\\Program Files\\Skyline\\TerraBuilder\\TerraBuilder.exe\" -script \"{0}\"", js); // -DisablePrint
                ReloadTB();
                err = Tools.ExecCmd(cmd, false, false);
                //string cmd = string.Format("\"C:\\Program Files\\Skyline\\TerraBuilder\\TerraBuilder.exe\" -script \"{0}\"", js); // -DisablePrint
                //err = Tools.ExecCmd(new List<string> { cmd });
                err = Tools.ExecExe("\"C:/Program Files/Skyline/TerraBuilder/TerraBuilder.exe\"", string.Format("-script \"{0}\"", js));
                isBusy = false;
                return File.Exists(MptPath) ? MoveMpt(MptPath, sourcePath) : null;
@@ -79,6 +79,39 @@
            finally
            {
                ending(time, sourcePath);
            }
        }
        /// <summary>
        /// 测试
        /// </summary>
        public static bool Test(ref string err)
        {
            string time = TimeStr;
            try
            {
                if (isBusy) throw new Exception("已有一个生成Mpt的任务正在执行");
                isBusy = true;
                string js = Path.Combine(SourcesPath, "tb.js");
                string newTbp = Path.Combine(Tools.TempDir, time, time + ".tbp");
                File.Copy(Path.Combine(SourcesPath, "tb.tbp"), Path.Combine(SourcesPath, "tb01.tbp"), true);
                //string cmd = string.Format("\"C:/Program Files/Skyline/TerraBuilder/TerraBuilder.exe\" -script \"{0}\"", js); // -DisablePrint
                ReloadTB();
                //err = Tools.ExecCmdForWin(new List<string> { cmd });
                err = Tools.ExecExe("\"C:/Program Files/Skyline/TerraBuilder/TerraBuilder.exe\"", string.Format("-script \"{0}\"", js), false);
                isBusy = false;
                return File.Exists(MptPath);
            }
            catch (Exception ex)
            {
                LogOut.Error(ex.Message + "\r\n" + ex.StackTrace);
                err = ex.Message;
                isBusy = false;
                return false;
            }
        }
@@ -100,6 +133,7 @@
        /// </summary>
        private static void MoveFilesToTemp(string sourcePath, string targetPath)
        {
            LogOut.Info("TB.移动文件 -> " + sourcePath);
            MoveFolder(Path.Combine(sourcePath, "数字正射影像图"), Path.Combine(targetPath, "img"));
            MoveFolder(Path.Combine(sourcePath, "数字高程模型"), Path.Combine(targetPath, "dem"));
            MoveFolder(Path.Combine(sourcePath, "中线裁剪范围"), Path.Combine(targetPath, "shp"));
@@ -167,7 +201,7 @@
            //list.Add("taskkill /f /t /im TBFuser.exe");
            //list.Add("start /d \"C:\\Program Files\\Skyline\\TerraBuilder Fuser\" TBFuser.exe /b");
            Tools.ExecCmd(list, false);
            Tools.ExecCmd(list);
        }
        /// <summary>