From 3936124a6177e20f8b0f8a7cd93866a6573c7006 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期三, 02 八月 2023 21:19:03 +0800 Subject: [PATCH] 修改结束任务功能 --- ExportMap/cs/CommonUtils.cs | 24 ++++++++++++++++++++++++ ExportMap/Models/SysTask.cs | 6 ++++++ 2 files changed, 30 insertions(+), 0 deletions(-) diff --git a/ExportMap/Models/SysTask.cs b/ExportMap/Models/SysTask.cs index 25bacfc..3712c52 100644 --- a/ExportMap/Models/SysTask.cs +++ b/ExportMap/Models/SysTask.cs @@ -11,8 +11,14 @@ public string name { set; get; } + /// <summary> + /// 鐘舵�侊細0-鏈紑濮嬶紝1-杩涜涓紝2-姝e父缁撴潫锛�3-鐢ㄦ埛缁撴潫锛�4-杩愯鍑洪敊 + /// </summary> public int status { set; get; } + /// <summary> + /// 绫诲埆锛欴OM锛孌EM锛孧PT锛�3DML锛孋PT锛孊IM锛孡AS锛孫SGB + /// </summary> public string type { set; get; } public string descr { set; get; } diff --git a/ExportMap/cs/CommonUtils.cs b/ExportMap/cs/CommonUtils.cs index 05102e3..0ad0155 100644 --- a/ExportMap/cs/CommonUtils.cs +++ b/ExportMap/cs/CommonUtils.cs @@ -53,7 +53,19 @@ List<int> list = new List<int>(); try { + List<SysTask> tasks = TaskDBHelper.SelectByIds(args.ids); + if (null == tasks || 0 == tasks.Count) return list; + string ip = Tools.GetLocalIP(); + foreach (SysTask task in tasks) + { + if (ip != task.ip) continue; + + task.err = KillProcess(task.id); + task.status = 3; + task.update_user = args.userId; + TaskDBHelper.Update(task); + } } catch (Exception ex) { @@ -63,5 +75,17 @@ return list; } + + /// <summary> + /// 鏉�姝昏繘绋� + /// </summary> + public static string KillProcess(int processId) + { + List<string> list = new List<string>(); + string cmd = string.Format("taskkill /f /t /pid {0}", processId); + list.Add(cmd); + + return Tools.ExecCmd(list, false); + } } } -- Gitblit v1.9.3