From 3e707d56a647c29055e1e64800a9300e9c1aa091 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期六, 12 十一月 2022 14:41:35 +0800 Subject: [PATCH] 1 --- ExportMap/cs/ExportUtil.cs | 19 +++++++++++-------- 1 files changed, 11 insertions(+), 8 deletions(-) diff --git a/ExportMap/cs/ExportUtil.cs b/ExportMap/cs/ExportUtil.cs index 87df402..e7752b8 100644 --- a/ExportMap/cs/ExportUtil.cs +++ b/ExportMap/cs/ExportUtil.cs @@ -1,4 +1,5 @@ -锘縰sing LFServer.Models; +锘縰sing ExportMap.cs; +using LFServer.Models; using Newtonsoft.Json; using System; using System.Collections.Generic; @@ -140,6 +141,7 @@ try { string cmdText = string.Format("python {0} -qgz {1} -qpt {2}", py, qgz, qpt); + LogOut.Info(cmdText); Process p = new Process(); p.StartInfo.FileName = "cmd.exe"; @@ -160,10 +162,9 @@ string info = so.ReadToEnd(); str = se.ReadToEnd(); - if (p.HasExited == false) - { - p.Kill(); - } + + if (!string.IsNullOrEmpty(str)) LogOut.Error(str); + if (p.HasExited == false) p.Kill(); si.Close(); so.Close(); @@ -172,6 +173,7 @@ } catch (Exception ex) { + LogOut.Error(ex.StackTrace); str = ex.Message; } @@ -182,8 +184,9 @@ /// 鐢熸垚 /// </summary> /// <param name="args">鍑哄浘鍙傛暟</param> + /// <param name="err">閿欒淇℃伅</param> /// <returns>鍥剧墖璺緞</returns> - public static string Generate(ExportArgs args) + public static string Generate(ExportArgs args, ref string err) { string date = DateStr; string sub = GetExportSubFolder(); @@ -194,7 +197,7 @@ args.SetDefault(); CreateTemplate(args); - string info = ExecPython(PyFile, qgz, args.qpt); + err = ExecPython(PyFile, qgz, args.qpt); string qptFile = Path.Combine(SourcesPath, args.qpt); if (File.Exists(qptFile)) @@ -262,7 +265,7 @@ return rm != null && rm.code == 200 && rm.result; } - catch (Exception ex) + catch { return false; } -- Gitblit v1.9.3