暫時關閉誇月查詢

This commit is contained in:
張家睿 2024-01-29 18:24:35 +08:00
parent 2a89454628
commit 34635571a9
2 changed files with 35 additions and 33 deletions

View File

@ -75,7 +75,7 @@ namespace FrontendWebApi.ApiControllers
catch (Exception exception)
{
apiResult.Code = "9999";
apiResult.Msg = "系統內部錯誤,請聯絡管理者。" + exception.Message;
apiResult.Msg = "系統內部錯誤,請聯絡管理者。";
//Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
}
@ -106,7 +106,7 @@ namespace FrontendWebApi.ApiControllers
catch (Exception exception)
{
apiResult.Code = "9999";
apiResult.Msg = "系統內部錯誤,請聯絡管理者。" + exception.Message;
apiResult.Msg = "系統內部錯誤,請聯絡管理者。";
if (exception.Message.Contains($" for key 'PRIMARY'"))
{
apiResult.Msg = "已有相同使用者。";
@ -140,7 +140,7 @@ namespace FrontendWebApi.ApiControllers
catch (Exception exception)
{
apiResult.Code = "9999";
apiResult.Msg = "系統內部錯誤,請聯絡管理者。" + exception.Message;
apiResult.Msg = "系統內部錯誤,請聯絡管理者。";
if (exception.Message.Contains($"a foreign key constraint"))
{
apiResult.Msg = "水電報表仍有該用戶,無法修改名稱。";
@ -167,7 +167,7 @@ namespace FrontendWebApi.ApiControllers
catch (Exception exception)
{
apiResult.Code = "9999";
apiResult.Msg = "系統內部錯誤,請聯絡管理者。" + exception.Message;
apiResult.Msg = "系統內部錯誤,請聯絡管理者。";
if (exception.Message.Contains($"a foreign key constraint"))
{
apiResult.Msg = "水電報表仍有該用戶,無法刪除。";
@ -222,7 +222,7 @@ namespace FrontendWebApi.ApiControllers
catch (Exception exception)
{
apiResult.Code = "9999";
apiResult.Msg = "系統內部錯誤,請聯絡管理者。" + exception.Message;
apiResult.Msg = "系統內部錯誤,請聯絡管理者。";
//Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
}
@ -273,27 +273,29 @@ namespace FrontendWebApi.ApiControllers
}
else
{
sqlString =
$"UPDATE {TenantBilltable} " +
$"set tenant_name = (SELECT tenant_name from archive_electric_meter_tenant_list WHERE tenant_guid = '{tb.tenant_guid}'), start_timestamp = '{start_timestamp}',end_timestamp = '{end_timestamp}' , " +
$"result= " +
$"(SELECT sum(sub_result) " +
$"FROM ( " +
$" SELECT start_timestamp,device_number, sub_result " +
$" FROM archive_electric_water_meter_day_{startMonth} " +
$" WHERE device_number = '{tb.device_number}' " +
$" UNION ALL " +
$" SELECT start_timestamp,device_number, sub_result " +
$" FROM archive_electric_water_meter_day_{endMonth} " +
$" WHERE device_number = '{tb.device_number}' " +
$") combined_result " +
$"WHERE start_timestamp BETWEEN '{start_timestamp}' and '{end_timestamp}' " +
$"GROUP BY device_number) ," +
$"bill = " +
$"ROUND(result *(SELECT {bill_per} from {TenantListtable} WHERE tenant_guid = '{tb.tenant_guid}') ), " +
$"updated_at = '{updated_at}', " +
$"tenant_guid = '{tb.tenant_guid}' " +
$"WHERE device_number = '{tb.device_number}'";
//sqlString =
// $"UPDATE {TenantBilltable} " +
// $"set tenant_name = (SELECT tenant_name from archive_electric_meter_tenant_list WHERE tenant_guid = '{tb.tenant_guid}'), start_timestamp = '{start_timestamp}',end_timestamp = '{end_timestamp}' , " +
// $"result= " +
// $"(SELECT sum(sub_result) " +
// $"FROM ( " +
// $" SELECT start_timestamp,device_number, sub_result " +
// $" FROM archive_electric_water_meter_day_{startMonth} " +
// $" WHERE device_number = '{tb.device_number}' " +
// $" UNION ALL " +
// $" SELECT start_timestamp,device_number, sub_result " +
// $" FROM archive_electric_water_meter_day_{endMonth} " +
// $" WHERE device_number = '{tb.device_number}' " +
// $") combined_result " +
// $"WHERE start_timestamp BETWEEN '{start_timestamp}' and '{end_timestamp}' " +
// $"GROUP BY device_number) ," +
// $"bill = " +
// $"ROUND(result *(SELECT {bill_per} from {TenantListtable} WHERE tenant_guid = '{tb.tenant_guid}') ), " +
// $"updated_at = '{updated_at}', " +
// $"tenant_guid = '{tb.tenant_guid}' " +
// $"WHERE device_number = '{tb.device_number}'";
apiResult.Code = "9999";
apiResult.Msg = "請選擇同一個月份";
}
@ -307,7 +309,7 @@ namespace FrontendWebApi.ApiControllers
catch (Exception exception)
{
apiResult.Code = "9999";
apiResult.Msg = "系統內部錯誤,請聯絡管理者。" + exception.Message;
apiResult.Msg = "系統內部錯誤,請聯絡管理者。";
//Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
}
@ -348,7 +350,7 @@ namespace FrontendWebApi.ApiControllers
}
catch (Exception exception)
{
_logger.LogError(exception.ToString());
//Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
}
return new FileContentResult(new byte[0], "application/pdf")
{
@ -431,7 +433,7 @@ namespace FrontendWebApi.ApiControllers
{
string path = Configuration.GetValue<string>("FilePath:OutputFormTemplate");
//string path = _webHostEnvironment.ContentRootPath + "\\StaticFiles\\import.html";
if (!File.Exists(path))
if (!System.IO.File.Exists(path))
{
return "";
}
@ -445,7 +447,7 @@ namespace FrontendWebApi.ApiControllers
{
bill += $" <div class=\"container a4-page\"> " +
$" <div class=\"header\"> " +
$" <img src=\"/img/dome.png\" alt=\"Taipei Dome Logo\" width=\"200\"> " +
$" <img src=\"C:\\jay.chang\\ibms\\FrontendWebApi\\wwwroot\\img\\dome.png\" alt=\"Taipei Dome Logo\" width=\"200\"> " +
$" <h2>水電費用明細</h2> " +
$" </div> " +
$" <div class=\"statistics\"> " +

View File

@ -13,8 +13,8 @@
"JwtLifeSeconds": 3600
},
"FilePath": {
"OutputForm": "D:\\jay.chang\\FrontendWebApi\\wwwroot\\upload\\OutputForm\\", //
"OutputFormTemplate": "D:\\jay.chang\\FrontendWebApi\\wwwroot\\upload\\OutputFormTemplate\\import.html" //
"OutputForm": "C:\\jay.chang\\ibms\\FrontendWebApi\\wwwroot\\upload\\OutputForm\\", //
"OutputFormTemplate": "C:\\jay.chang\\ibms\\FrontendWebApi\\wwwroot\\upload\\OutputFormTemplate\\import.html" //
},
"DBConfig": {
"MySqlDBConfig": {