diff --git a/SolarPower/Controllers/AnalysisInverterController.cs b/SolarPower/Controllers/AnalysisInverterController.cs index 5676990..2539ff3 100644 --- a/SolarPower/Controllers/AnalysisInverterController.cs +++ b/SolarPower/Controllers/AnalysisInverterController.cs @@ -914,7 +914,14 @@ namespace SolarPower.Controllers } catch (Exception exception) { - apiResult.Code = "9999"; + if(exception.Message == "Fatal error encountered during command execution.") + { + apiResult.Code = "9984"; + } + else + { + apiResult.Code = "9999"; + } Logger.LogError("【" + controllerName + "/" + actionName + "】"); Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message); } diff --git a/SolarPower/Models/ErrorCode.cs b/SolarPower/Models/ErrorCode.cs index bb221c5..3b83845 100644 --- a/SolarPower/Models/ErrorCode.cs +++ b/SolarPower/Models/ErrorCode.cs @@ -17,10 +17,11 @@ namespace SolarPower.Models { { "0000", "OK" }, { "0001", "傳入參數錯誤。" }, - { "0002","請先刪除相關逆變器"}, - { "0003","請先刪除相關設備"}, - { "0004","請先移除相關逆變器綁定"}, - { "9985","該電站尚無逆變器資料"}, + { "0002", "請先刪除相關逆變器"}, + { "0003", "請先刪除相關設備"}, + { "0004", "請先移除相關逆變器綁定"}, + { "9984", "連線逾時"}, + { "9985", "該電站尚無逆變器資料"}, { "9986", "該帳號已被註冊,請重新輸入"}, { "9987", "查無該運維作業記錄檔案"}, { "9988", "查無該資料紀錄"}, diff --git a/SolarPower/Repository/Implement/PowerStationRepository.cs b/SolarPower/Repository/Implement/PowerStationRepository.cs index 32d5cf8..10acb47 100644 --- a/SolarPower/Repository/Implement/PowerStationRepository.cs +++ b/SolarPower/Repository/Implement/PowerStationRepository.cs @@ -4475,7 +4475,7 @@ namespace SolarPower.Repository.Implement } sql = "SELECT * FROM (" + string.Join(" UNION ", sql_perSiteDB) + ") a ORDER BY a.TIMESTAMP ASC"; - result = (await conn.QueryAsync(sql, new { NowDay = nowDay })).ToList(); + result = (await conn.QueryAsync(sql, new { NowDay = nowDay }, commandTimeout: 300)).ToList(); } catch (Exception exception) { diff --git a/SolarPower/Repository/Implement/StationReportRepository.cs b/SolarPower/Repository/Implement/StationReportRepository.cs index 3feab29..0097d0d 100644 --- a/SolarPower/Repository/Implement/StationReportRepository.cs +++ b/SolarPower/Repository/Implement/StationReportRepository.cs @@ -243,7 +243,7 @@ namespace SolarPower.Repository.Implement break; } - a = await conn.QueryAsync(sql,commandTimeout: 300); + a = await conn.QueryAsync(sql, commandTimeout: 300); } catch (Exception exception) {