1. 背景執行日月報表 迴圈加 try catch
This commit is contained in:
parent
082850213d
commit
458dff0078
@ -8,6 +8,7 @@ using SolarPower.Models.PowerStation;
|
|||||||
using SolarPower.Repository.Interface;
|
using SolarPower.Repository.Interface;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@ -870,9 +871,17 @@ namespace SolarPower.Quartz.Jobs
|
|||||||
|
|
||||||
#region 寄送日月報
|
#region 寄送日月報
|
||||||
var users = userRepository.GetAllAsync();
|
var users = userRepository.GetAllAsync();
|
||||||
|
var ttt = new List<string>() {
|
||||||
|
"s506488@gmail.com",
|
||||||
|
"cesarliuc@gmail.com"
|
||||||
|
};
|
||||||
|
|
||||||
foreach (var user in users.Result)
|
foreach (var user in users.Result)
|
||||||
{
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
logger.LogInformation("【CalcAvgPowerStationJob】【開始產生使用者[{0}({1})]的日月報】", user.Account, user.Name);
|
||||||
|
|
||||||
List<OperationPersonnel> powerstations = new List<OperationPersonnel>();
|
List<OperationPersonnel> powerstations = new List<OperationPersonnel>();
|
||||||
powerstations = await noticeScheduleRepository.GetPowerStationOperationPersonnel(user.Id);
|
powerstations = await noticeScheduleRepository.GetPowerStationOperationPersonnel(user.Id);
|
||||||
if (powerstations.Count == 0)
|
if (powerstations.Count == 0)
|
||||||
@ -1032,6 +1041,21 @@ namespace SolarPower.Quartz.Jobs
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.LogInformation("【CalcAvgPowerStationJob】【產生完成使用者[{0}({1})]的日月報】", user.Account, user.Name);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
logger.LogError("【CalcAvgPowerStationJob】【產生失敗使用者[{0}({1})]的日月報】", user.Account, user.Name);
|
||||||
|
logger.LogError("【CalcAvgPowerStationJob】[Exception] - {0}", exception.Message);
|
||||||
|
if (exception.InnerException != null)
|
||||||
|
{
|
||||||
|
logger.LogError("【CalcAvgPowerStationJob】[InnerException] - {0}", exception.InnerException.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
var line = new StackTrace(exception, true).GetFrame(0).GetFileLineNumber();
|
||||||
|
logger.LogError("【CalcAvgPowerStationJob】[錯誤行數] - {0}", line);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user