|
@@ -16,6 +16,7 @@ using XdCxRhDW.Repostory;
|
|
|
using XdCxRhDW.WebApi;
|
|
using XdCxRhDW.WebApi;
|
|
|
using System.Threading;
|
|
using System.Threading;
|
|
|
using Microsoft.Owin;
|
|
using Microsoft.Owin;
|
|
|
|
|
+using System.Diagnostics;
|
|
|
|
|
|
|
|
namespace XdCxRhDW.App.Controllers
|
|
namespace XdCxRhDW.App.Controllers
|
|
|
{
|
|
{
|
|
@@ -63,18 +64,23 @@ namespace XdCxRhDW.App.Controllers
|
|
|
if (item.TaskState == EnumTaskState.Stopped)
|
|
if (item.TaskState == EnumTaskState.Stopped)
|
|
|
Thread.Sleep(2000);
|
|
Thread.Sleep(2000);
|
|
|
item.TaskState = EnumTaskState.Stopped;
|
|
item.TaskState = EnumTaskState.Stopped;
|
|
|
|
|
+
|
|
|
|
|
+ LogRes res = new LogRes()
|
|
|
|
|
+ {
|
|
|
|
|
+ LogTime = DateTime.Now,
|
|
|
|
|
+ Module = Process.GetCurrentProcess().ProcessName,
|
|
|
|
|
+ LogType = EnumLogType.Info,
|
|
|
|
|
+ Msg = $"任务停止完成,ID={dto.ID},停止原因={dto.StopReason}",
|
|
|
|
|
+ };
|
|
|
|
|
+ db.LogRes.Add(res);
|
|
|
await db.SaveChangesAsync();
|
|
await db.SaveChangesAsync();
|
|
|
}
|
|
}
|
|
|
Messenger.Defalut.Pub("任务状态改变", dto.ID);
|
|
Messenger.Defalut.Pub("任务状态改变", dto.ID);
|
|
|
- if (dto.StopType == EnumTaskStopType.Properly)
|
|
|
|
|
- await LogHelper.Info($"任务停止完成,ID={dto.ID},停止原因={dto.StopReason}");
|
|
|
|
|
- else
|
|
|
|
|
- await LogHelper.Error($"任务停止完成,ID={dto.ID},停止原因={dto.StopReason}");
|
|
|
|
|
return Success();
|
|
return Success();
|
|
|
}
|
|
}
|
|
|
catch (Exception ex)
|
|
catch (Exception ex)
|
|
|
{
|
|
{
|
|
|
- await LogHelper.Error($"任务停止异常.ID={dto.ID}", ex);
|
|
|
|
|
|
|
+ Serilog.Log.Error(ex, $"任务停止异常.ID={dto.ID}");
|
|
|
return Error(ex.Message);
|
|
return Error(ex.Message);
|
|
|
|
|
|
|
|
}
|
|
}
|