[後端] 修改niagara同步預設值, 修改水電表列表問題, 修改排序程序
This commit is contained in:
parent
5992b5cfd2
commit
2206f5a3fe
@ -580,7 +580,7 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
{disasterjoinsql}
|
{disasterjoinsql}
|
||||||
LEFT JOIN building_menu bm ON d.device_building_tag = bm.building_tag AND d.device_system_tag = bm.main_system_tag AND d.device_name_tag = bm.sub_system_tag
|
LEFT JOIN building_menu bm ON d.device_building_tag = bm.building_tag AND d.device_system_tag = bm.main_system_tag AND d.device_name_tag = bm.sub_system_tag
|
||||||
where d.deleted = 0 and d.device_building_tag = '{post.building_tag}' {sWhere}
|
where d.deleted = 0 and d.device_building_tag = '{post.building_tag}' {sWhere}
|
||||||
order by d.device_number ASC, d.priority ASC";
|
order by d.priority ASC, left(device_serial_tag, LENGTH(device_serial_tag) - 1) ASC";
|
||||||
|
|
||||||
var devicelist = await backendRepository.GetAllAsync<DeviceFloor>(sql);
|
var devicelist = await backendRepository.GetAllAsync<DeviceFloor>(sql);
|
||||||
|
|
||||||
|
@ -244,10 +244,10 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
: input.tableType == "month" ? (Int32.Parse(input.startTime.Split("-")[0]) + 1) + "-01-01"
|
: input.tableType == "month" ? (Int32.Parse(input.startTime.Split("-")[0]) + 1) + "-01-01"
|
||||||
: input.tableType == "year" ? (Int32.Parse(input.endTime) + 1).ToString() + "-01-01"
|
: input.tableType == "year" ? (Int32.Parse(input.endTime) + 1).ToString() + "-01-01"
|
||||||
: null;
|
: null;
|
||||||
string dbDateName = startTime.Split("-")[0].ToString().PadLeft(4, '0') + startTime.Split("-")[1].ToString().PadLeft(2, '0');
|
|
||||||
string sqlWhere = "";
|
string sqlWhere = "";
|
||||||
string sqlGroup = "";
|
string sqlGroup = "";
|
||||||
string sqlAvgRawData = "";
|
string sqlAvgRawData = "";
|
||||||
|
string dbDateName = startTime.Split("-")[0].ToString().PadLeft(4, '0') + startTime.Split("-")[1].ToString().PadLeft(2, '0');
|
||||||
string buildingSql = "";
|
string buildingSql = "";
|
||||||
string tag_quantity = await backendRepository.GetOneAsync<string>("select system_value from variable where system_type = 'obixConfig' and system_key = 'tag_quantity' and deleted = 0");
|
string tag_quantity = await backendRepository.GetOneAsync<string>("select system_value from variable where system_type = 'obixConfig' and system_key = 'tag_quantity' and deleted = 0");
|
||||||
|
|
||||||
@ -272,7 +272,7 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
else
|
else
|
||||||
sqlAvgRawData = " round(avg_rawdata, 2) as avg_rawdata, start_timestamp, end_timestamp ";
|
sqlAvgRawData = " round(avg_rawdata, 2) as avg_rawdata, start_timestamp, end_timestamp ";
|
||||||
|
|
||||||
var table = input.tableType == "year" ? "archive_electric_meter_month" : "archive_electric_meter_" + input.tableType + (input.tableType == "day" ? "_" + dbDateName : "");
|
var table = input.tableType == "year" ? "archive_water_meter_month" : "archive_water_meter_" + input.tableType + (input.tableType == "day" ? "_" + dbDateName : "");
|
||||||
var schema = await backendRepository.GetOneAsync<string>($"select system_value from variable where system_type = 'project_name'");
|
var schema = await backendRepository.GetOneAsync<string>($"select system_value from variable where system_type = 'project_name'");
|
||||||
var isTable = await backendRepository.GetOneAsync<string>($"select table_name from information_schema.tables where table_name = '{table}' and table_schema = '{schema.Split('/')[0]}'");
|
var isTable = await backendRepository.GetOneAsync<string>($"select table_name from information_schema.tables where table_name = '{table}' and table_schema = '{schema.Split('/')[0]}'");
|
||||||
if (string.IsNullOrEmpty(isTable)) //check for has table or not
|
if (string.IsNullOrEmpty(isTable)) //check for has table or not
|
||||||
@ -307,9 +307,9 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
left join (
|
left join (
|
||||||
select device_number, {sqlAvgRawData}
|
select device_number, {sqlAvgRawData}
|
||||||
from {table}
|
from {table}
|
||||||
where start_timestamp >= {aemmStaDate} and end_timestamp < {aemmEndDate} and point = 'RCV' {buildingSql}
|
where start_timestamp >= @startTime and end_timestamp < @endTime and point = 'RCV' {buildingSql}
|
||||||
{sqlWhere} {sqlGroup}
|
{sqlWhere} {sqlGroup}
|
||||||
) aemm on aemm.start_timestamp >= fd.date and aemm.end_timestamp < DATE_ADD(fd.date, INTERVAL +1 {input.tableType}) and aemm.device_number = fd.device_number
|
) aemm on aemm.start_timestamp >= {aemmStaDate} and aemm.end_timestamp < {aemmEndDate} and aemm.device_number = fd.device_number
|
||||||
order by fd.device_number, fd.date";
|
order by fd.device_number, fd.date";
|
||||||
|
|
||||||
var rawData = await backendRepository.GetAllAsync<HydroMeterRawDataOutput>(sql,
|
var rawData = await backendRepository.GetAllAsync<HydroMeterRawDataOutput>(sql,
|
||||||
|
@ -17,8 +17,8 @@
|
|||||||
"Server": "FYlY+w0XDIz+jmF2rlZWJw==", //0.201
|
"Server": "FYlY+w0XDIz+jmF2rlZWJw==", //0.201
|
||||||
"Port": "js2LutKe+rdjzdxMPQUrvQ==",
|
"Port": "js2LutKe+rdjzdxMPQUrvQ==",
|
||||||
//"Database": "VJB2XC+lAtzuHObDGMVOAA==", //30
|
//"Database": "VJB2XC+lAtzuHObDGMVOAA==", //30
|
||||||
"Database": "IgYBsgG2VLKKxFb64j7LOA==", //wsp
|
//"Database": "IgYBsgG2VLKKxFb64j7LOA==", //wsp
|
||||||
//"Database": "7gWfmZ28HGIJZbxEbK+0yg==", //tpe_dome_dome
|
"Database": "7gWfmZ28HGIJZbxEbK+0yg==", //tpe_dome_dome
|
||||||
//"Database": "siTUcDaC/g2yGTMFWD72Kg==", //tpe_dome_hotel
|
//"Database": "siTUcDaC/g2yGTMFWD72Kg==", //tpe_dome_hotel
|
||||||
//"Database": "iuaY0h0+TWkir44/eZLDqw==", //tpe_dome_office
|
//"Database": "iuaY0h0+TWkir44/eZLDqw==", //tpe_dome_office
|
||||||
//"Database": "Rq7Gn4x6LwBvVtl7GY8LbA==", //MCUT
|
//"Database": "Rq7Gn4x6LwBvVtl7GY8LbA==", //MCUT
|
||||||
|
@ -581,14 +581,12 @@ namespace Repository.BackendRepository.Implement
|
|||||||
#region insert building_menu
|
#region insert building_menu
|
||||||
if (bm.Count == 0)
|
if (bm.Count == 0)
|
||||||
{
|
{
|
||||||
sb.Append(@"insert building_menu(building_tag, main_system_tag, sub_system_tag, device_building_tag, device_system_tag,
|
sb.Append(@$"insert building_menu(building_tag, main_system_tag, sub_system_tag, device_building_tag, device_system_tag,
|
||||||
|
left_drawing, left_icon_click, left_icon_click_url_width, left_icon_click_url_height, left_planimetric_click,
|
||||||
is_link, created_by, created_at, updated_by, updated_at)
|
is_link, created_by, created_at, updated_by, updated_at)
|
||||||
VALUES ('" + data.device_building_tag + "', '" +
|
values('{data.device_building_tag}', '{data.device_system_tag}', '{data.device_name_tag}', '{data.device_building_tag}', '{data.device_system_tag}',
|
||||||
data.device_system_tag + "', '" +
|
2, 0, 0, 0, 1
|
||||||
data.device_name_tag + "', '" +
|
1, 'B43E3CA7-96DD-4FC7-B6E6-974ACC3B0878', now(), 'B43E3CA7-96DD-4FC7-B6E6-974ACC3B0878', now());");
|
||||||
data.device_building_tag + "', '" +
|
|
||||||
data.device_system_tag + "', " +
|
|
||||||
"1, 'B43E3CA7-96DD-4FC7-B6E6-974ACC3B0878', now(), 'B43E3CA7-96DD-4FC7-B6E6-974ACC3B0878', now() );");
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
@ -772,7 +770,7 @@ namespace Repository.BackendRepository.Implement
|
|||||||
sb.Append("update device d inner JOIN import_niagara_tag m ON m.niagara_tags = d.device_number " +
|
sb.Append("update device d inner JOIN import_niagara_tag m ON m.niagara_tags = d.device_number " +
|
||||||
"set d.full_name=m.device_full_name " +
|
"set d.full_name=m.device_full_name " +
|
||||||
"where m.device_full_name<>d.full_name;");
|
"where m.device_full_name<>d.full_name;");
|
||||||
await conn.ExecuteAsync(sb.ToString(), commandTimeout: 200);
|
await conn.ExecuteAsync(sb.ToString(), commandTimeout: 999);
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user