[WebApi]水電報表Bug修正

This commit is contained in:
張家睿 2024-03-05 11:54:37 +08:00
parent 0fe5ad831c
commit 785dbd0859

View File

@ -314,16 +314,14 @@ namespace FrontendWebApi.ApiControllers
string checkDataSql = $@"(SELECT sum(sub_result) string checkDataSql = $@"(SELECT sum(sub_result)
FROM ( {month} FROM ( {month}
) combined_result ) combined_result
WHERE start_timestamp BETWEEN '{start_timestamp}' and '{end_timestamp}' WHERE start_timestamp BETWEEN '{start_timestamp}' and '{end_timestamp}') ";
GROUP BY device_number) ";
var existData = await backendRepository.GetAllAsync<string>(checkDataSql); var existData = await backendRepository.GetAllAsync<string>(checkDataSql);
if (existData.Count != 0) if (existData.Count != 0)
{ {
result = $@"(SELECT sum(sub_result) result = $@"(SELECT ROUND(sum(sub_result))
FROM ( {month} FROM ( {month}
) combined_result ) combined_result
WHERE start_timestamp BETWEEN '{start_timestamp}' and '{end_timestamp}' WHERE start_timestamp BETWEEN '{start_timestamp}' and '{end_timestamp}') ";
GROUP BY device_number) ";
} }
sqlString = sqlString =
$@"UPDATE {TenantBilltable} $@"UPDATE {TenantBilltable}
@ -416,6 +414,7 @@ namespace FrontendWebApi.ApiControllers
{ {
t.start_timestamp = tb.start_timestamp; t.start_timestamp = tb.start_timestamp;
t.end_timestamp = tb.end_timestamp; t.end_timestamp = tb.end_timestamp;
t.tableType = t.device_name_tag == "E4" ? "elec": "water";
await UpdateTenantBill(t); await UpdateTenantBill(t);
} }
} }