Merge branch 'master' of https://gitea.mjm-staging.developers-homelab.net/BIMS/BIMS
This commit is contained in:
commit
de52fc27b9
@ -20,6 +20,7 @@ using NPOI.SS.Formula.Functions;
|
|||||||
using Microsoft.AspNetCore.Localization;
|
using Microsoft.AspNetCore.Localization;
|
||||||
using MySqlX.XDevAPI.Relational;
|
using MySqlX.XDevAPI.Relational;
|
||||||
using Backend.Models;
|
using Backend.Models;
|
||||||
|
using NPOI.OpenXmlFormats.Dml;
|
||||||
|
|
||||||
namespace Backend.Services.Implement
|
namespace Backend.Services.Implement
|
||||||
{
|
{
|
||||||
@ -263,9 +264,12 @@ namespace Backend.Services.Implement
|
|||||||
|
|
||||||
row.parent_path = stationName;
|
row.parent_path = stationName;
|
||||||
//full_name 其實是點位名稱 point_name
|
//full_name 其實是點位名稱 point_name
|
||||||
row.full_name = conPoint.Where(x => x.name.Contains(tagName.Replace('_', '/')) && !x.isHistory).Select(x => x.displayName).FirstOrDefault();
|
var deviceNumber = tagName.Substring(0, tagName.LastIndexOf(tagName.Split("_")[5]) - 1);
|
||||||
if (conPoint.Where(x => x.name.Contains(tagName.Replace('_', '/')) && !x.isHistory).FirstOrDefault() != null)
|
var point = tagName.Split("_")[5];
|
||||||
conPoint.Where(x => x.name.Contains(tagName.Replace('_', '/')) && !x.isHistory).FirstOrDefault().isHistory = true;
|
conPoint = conPoint.Where(x => x.name.Split("/").Length > 6).ToList();
|
||||||
|
row.full_name = conPoint.Where(x => x.name.Split("/")[5] == deviceNumber && x.name.Split("/")[6] == point && !x.isHistory).Select(x => x.displayName).FirstOrDefault();
|
||||||
|
if (conPoint.Where(x => x.name.Split("/")[5] == deviceNumber && x.name.Split("/")[6] == point && !x.isHistory).FirstOrDefault() != null)
|
||||||
|
conPoint.Where(x => x.name.Split("/")[5] == deviceNumber && x.name.Split("/")[6] == point && !x.isHistory).FirstOrDefault().isHistory = true;
|
||||||
row.isHistory = true;
|
row.isHistory = true;
|
||||||
result.Add(row);
|
result.Add(row);
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
//"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
|
||||||
"Root": "SzdxEgaJJ7tcTCrUl2zKsA==",
|
"Root": "SzdxEgaJJ7tcTCrUl2zKsA==",
|
||||||
"Password": "FVAPxztxpY4gJJKQ/se4bQ=="
|
"Password": "FVAPxztxpY4gJJKQ/se4bQ=="
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
//"Database": "VJB2XC+lAtzuHObDGMVOAA==", //三菱
|
//"Database": "VJB2XC+lAtzuHObDGMVOAA==", //三菱
|
||||||
//"Database": "IgYBsgG2VLKKxFb64j7LOA==", //wsp
|
//"Database": "IgYBsgG2VLKKxFb64j7LOA==", //wsp
|
||||||
"Database": "7gWfmZ28HGIJZbxEbK+0yg==", //tpe_dome_dome
|
"Database": "7gWfmZ28HGIJZbxEbK+0yg==", //tpe_dome_dome
|
||||||
|
//"Database": "iuaY0h0+TWkir44/eZLDqw==", //tpe_dome_office
|
||||||
"Root": "SzdxEgaJJ7tcTCrUl2zKsA==",
|
"Root": "SzdxEgaJJ7tcTCrUl2zKsA==",
|
||||||
"Password": "FVAPxztxpY4gJJKQ/se4bQ=="
|
"Password": "FVAPxztxpY4gJJKQ/se4bQ=="
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
public class AlarmRecordController : MyBaseApiController<AlarmRecordController>
|
public class AlarmRecordController : MyBaseApiController<AlarmRecordController>
|
||||||
{
|
{
|
||||||
private readonly IFrontendRepository frontendRepository;
|
private readonly IFrontendRepository frontendRepository;
|
||||||
|
|
||||||
public AlarmRecordController
|
public AlarmRecordController
|
||||||
(
|
(
|
||||||
IFrontendRepository frontendRepository
|
IFrontendRepository frontendRepository
|
||||||
@ -47,41 +47,41 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var sqlBuildingMain = $@"SELECT
|
var sqlBuildingMain = $@"SELECT
|
||||||
b.building_guid,
|
b.building_tag,
|
||||||
b.full_name AS building_name,
|
b.full_name AS building_name,
|
||||||
ms.main_system_guid,
|
v1.system_value,
|
||||||
ms.full_name AS main_system_name
|
v1.system_key
|
||||||
FROM building_menu bm
|
FROM building_menu bm
|
||||||
INNER JOIN (
|
INNER JOIN (
|
||||||
SELECT
|
SELECT
|
||||||
ap.building_guid, ap.ShowView
|
ap.building_tag, ap.ShowView
|
||||||
FROM role_auth ra
|
FROM role_auth ra
|
||||||
JOIN auth_page ap ON ra.AuthCode = ap.AuthCode
|
JOIN auth_page ap ON ra.AuthCode = ap.AuthCode
|
||||||
JOIN userinfo u ON u.role_guid = ra.role_guid WHERE u.account = @Account
|
JOIN userinfo u ON u.role_guid = ra.role_guid WHERE u.account = @Account
|
||||||
AND ap.building_guid IS NOT NULL
|
AND ap.building_tag IS NOT NULL
|
||||||
) ap ON bm.building_guid = ap.building_guid AND bm.sub_system_guid = ap.ShowView
|
) ap ON bm.building_tag = ap.building_tag
|
||||||
LEFT JOIN building b ON bm.building_guid = b.building_guid
|
LEFT JOIN building b ON bm.building_tag = b.building_tag
|
||||||
LEFT JOIN main_system ms ON bm.main_system_guid = ms.main_system_guid
|
left join variable v2 on ap.ShowView = v2.id and v2.deleted = 0
|
||||||
GROUP BY bm.building_guid, bm.main_system_guid
|
left join variable v1 on v2.system_parent_id = v1.id
|
||||||
ORDER BY b.priority, ms.priority";
|
GROUP BY b.building_tag, b.full_name, v1.system_value, v1.system_key";
|
||||||
|
|
||||||
var alarmRecordPanelRawDatas = await frontendRepository.GetAllAsync<AlarmRecordPanelRawData>(sqlBuildingMain, new { Account = account });
|
var alarmRecordPanelRawDatas = await frontendRepository.GetAllAsync<AlarmRecordPanelRawData>(sqlBuildingMain, new { Account = account });
|
||||||
|
|
||||||
List<AlarmRecordPanel> alarmRecordPanels = new List<AlarmRecordPanel>();
|
List<AlarmRecordPanel> alarmRecordPanels = new List<AlarmRecordPanel>();
|
||||||
|
|
||||||
var alarmRecordPanelRawDatas_GroupBy = alarmRecordPanelRawDatas.GroupBy(x => x.building_guid);
|
var alarmRecordPanelRawDatas_GroupBy = alarmRecordPanelRawDatas.GroupBy(x => x.building_tag);
|
||||||
|
|
||||||
foreach (var building in alarmRecordPanelRawDatas_GroupBy)
|
foreach (var building in alarmRecordPanelRawDatas_GroupBy)
|
||||||
{
|
{
|
||||||
AlarmRecordPanel alarmRecordPanel = new AlarmRecordPanel();
|
AlarmRecordPanel alarmRecordPanel = new AlarmRecordPanel();
|
||||||
alarmRecordPanel.building_guid = building.Key;
|
alarmRecordPanel.building_tag = building.Key;
|
||||||
alarmRecordPanel.building_name = building.First().building_name;
|
alarmRecordPanel.building_name = building.First().building_name;
|
||||||
alarmRecordPanel.mainSystemPanels = new List<MainSystemPanel>();
|
alarmRecordPanel.mainSystemPanels = new List<MainSystemPanel>();
|
||||||
foreach (var tempData in building)
|
foreach (var tempData in building)
|
||||||
{
|
{
|
||||||
MainSystemPanel mainSystemPanel = new MainSystemPanel();
|
MainSystemPanel mainSystemPanel = new MainSystemPanel();
|
||||||
mainSystemPanel.main_system_guid = tempData.main_system_guid;
|
mainSystemPanel.system_value = tempData.system_value;
|
||||||
mainSystemPanel.main_system_name = tempData.main_system_name;
|
mainSystemPanel.system_key = tempData.system_key;
|
||||||
|
|
||||||
alarmRecordPanel.mainSystemPanels.Add(mainSystemPanel);
|
alarmRecordPanel.mainSystemPanels.Add(mainSystemPanel);
|
||||||
}
|
}
|
||||||
@ -115,31 +115,31 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var sql = $@"SELECT
|
var sql = $@"SELECT
|
||||||
temp_path.source AS alarm_path,
|
temp_path.source AS alarm_path,
|
||||||
temp_msg.source_msg AS msgText,
|
temp_msg.source_msg AS msgText,
|
||||||
from_unixtime(record.timestamp/1000,'%Y-%m-%d %H:%i:%s') alarm_timestamp,
|
from_unixtime(record.timestamp/1000,'%Y-%m-%d %H:%i:%s') alarm_timestamp,
|
||||||
record.priority,
|
record.priority,
|
||||||
CASE WHEN record.normalTime > 0 THEN from_unixtime(record.normalTime/1000,'%Y-%m-%d %H:%i:%s')
|
CASE WHEN record.normalTime > 0 THEN from_unixtime(record.normalTime/1000,'%Y-%m-%d %H:%i:%s')
|
||||||
ELSE NULL
|
ELSE NULL
|
||||||
END AS normal_timestamp,
|
END AS normal_timestamp,
|
||||||
record.sourceState AS ackState,
|
record.sourceState AS ackState,
|
||||||
class.alarmclass AS alarm_className,
|
class.alarmclass AS alarm_className,
|
||||||
record.userAccount
|
record.userAccount
|
||||||
|
|
||||||
FROM alarmorion_orionalarmrecord record
|
FROM alarmOrion_OrionAlarmRecord record
|
||||||
JOIN (
|
JOIN (
|
||||||
SELECT sourceorder.* ,temp_source.source
|
SELECT sourceorder.* ,temp_source.source
|
||||||
FROM alarmorion_orionalarmsourceorder sourceorder
|
FROM alarmOrion_OrionAlarmSourceOrder sourceorder
|
||||||
JOIN alarmorion_orionalarmsource temp_source ON sourceorder.alarmSource = temp_source.id
|
JOIN alarmOrion_OrionAlarmSource temp_source ON sourceorder.alarmSource = temp_source.id
|
||||||
) temp_path ON record.id = temp_path.alarm
|
) temp_path ON record.id = temp_path.alarm
|
||||||
JOIN(
|
JOIN(
|
||||||
SELECT
|
SELECT
|
||||||
val.alarm,
|
val.alarm,
|
||||||
val.value AS source_msg
|
val.value AS source_msg
|
||||||
FROM alarmorion_orionalarmfacetvalue val
|
FROM alarmOrion_OrionAlarmFacetValue val
|
||||||
JOIN alarmorion_orionalarmfacetname nam ON val.facetName = nam.id AND nam.facetName = 'msgText'
|
JOIN alarmOrion_OrionAlarmFacetName nam ON val.facetName = nam.id AND nam.facetName = 'msgText'
|
||||||
) temp_msg ON record.id = temp_msg.alarm
|
) temp_msg ON record.id = temp_msg.alarm
|
||||||
JOIN alarmorion_orionalarmclass class ON record.alarmClass = class.id
|
JOIN alarmOrion_OrionAlarmClass class ON record.alarmClass = class.id
|
||||||
WHERE from_unixtime(record.timestamp/1000,'%Y-%m-%d %H:%i:%s') BETWEEN @StartTimestamp AND @EndTimeStamp";
|
WHERE from_unixtime(record.timestamp/1000,'%Y-%m-%d %H:%i:%s') BETWEEN @StartTimestamp AND @EndTimeStamp";
|
||||||
|
|
||||||
if (post.IsSolve != 0)
|
if (post.IsSolve != 0)
|
||||||
@ -183,8 +183,8 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
var sql_device = $@"SELECT *
|
var sql_device = $@"SELECT *
|
||||||
FROM device d
|
FROM device d
|
||||||
WHERE d.deleted = 0
|
WHERE d.deleted = 0
|
||||||
AND d.building_guid = @building_guid
|
AND d.device_building_tag = @building_tag
|
||||||
AND d.main_system_guid IN @main_system_guids";
|
AND d.device_system_tag IN @main_system_tag";
|
||||||
|
|
||||||
var devices = await frontendRepository.GetAllAsync<Device>(sql_device, post);
|
var devices = await frontendRepository.GetAllAsync<Device>(sql_device, post);
|
||||||
|
|
||||||
|
@ -532,6 +532,7 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
left join device_master dm ON d.device_building_tag = dm.device_building_tag
|
left join device_master dm ON d.device_building_tag = dm.device_building_tag
|
||||||
AND d.device_name_tag = dm.device_name_tag
|
AND d.device_name_tag = dm.device_name_tag
|
||||||
left join device_item di ON d.device_name_tag = di.device_name_tag
|
left join device_item di ON d.device_name_tag = di.device_name_tag
|
||||||
|
AND di.device_building_tag = '{post.building_tag}'
|
||||||
AND di.deleted = 0
|
AND di.deleted = 0
|
||||||
AND di.is_show_riserDiagram = 1
|
AND di.is_show_riserDiagram = 1
|
||||||
left join floor f on d.device_floor_tag = f.full_name and f.deleted = 0
|
left join floor f on d.device_floor_tag = f.full_name and f.deleted = 0
|
||||||
@ -581,41 +582,41 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
{
|
{
|
||||||
var device_url = string.Empty;
|
var device_url = string.Empty;
|
||||||
|
|
||||||
if (((de.icon_click & 1) > 0) && !string.IsNullOrEmpty(de.icon_click_url))
|
if (((de.left_icon_click & 1) > 0) && !string.IsNullOrEmpty(de.left_icon_click_url))
|
||||||
{
|
{
|
||||||
device_url = de.icon_click_url;
|
device_url = de.left_icon_click_url;
|
||||||
//點擊顯示系統圖
|
//點擊顯示系統圖
|
||||||
if (de.icon_click_url.Contains("[device_building_tag]"))
|
if (de.left_icon_click_url.Contains("[device_building_tag]"))
|
||||||
{
|
{
|
||||||
device_url = device_url.Replace("[device_building_tag]", de.device_building_tag);
|
device_url = device_url.Replace("[device_building_tag]", de.device_building_tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (de.icon_click_url.Contains("[device_system_tag]"))
|
if (de.left_icon_click_url.Contains("[device_system_tag]"))
|
||||||
{
|
{
|
||||||
device_url = device_url.Replace("[device_system_tag]", de.device_system_tag);
|
device_url = device_url.Replace("[device_system_tag]", de.device_system_tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (de.icon_click_url.Contains("[device_floor_tag]"))
|
if (de.left_icon_click_url.Contains("[device_floor_tag]"))
|
||||||
{
|
{
|
||||||
device_url = device_url.Replace("[device_floor_tag]", de.device_floor_tag);
|
device_url = device_url.Replace("[device_floor_tag]", de.device_floor_tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (de.icon_click_url.Contains("[device_name_tag]"))
|
if (de.left_icon_click_url.Contains("[device_name_tag]"))
|
||||||
{
|
{
|
||||||
device_url = device_url.Replace("[device_name_tag]", de.device_name_tag);
|
device_url = device_url.Replace("[device_name_tag]", de.device_name_tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (de.icon_click_url.Contains("[device_serial_tag]"))
|
if (de.left_icon_click_url.Contains("[device_serial_tag]"))
|
||||||
{
|
{
|
||||||
device_url = device_url.Replace("[device_serial_tag]", de.device_serial_tag);
|
device_url = device_url.Replace("[device_serial_tag]", de.device_serial_tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (de.icon_click_url.Contains("[tag_name]"))
|
if (de.left_icon_click_url.Contains("[tag_name]"))
|
||||||
{
|
{
|
||||||
device_url = device_url.Replace("[tag_name]", de.device_number);
|
device_url = device_url.Replace("[tag_name]", de.device_number);
|
||||||
}
|
}
|
||||||
|
|
||||||
de.icon_click_url = null;
|
de.left_icon_click_url = null;
|
||||||
de.DeviceURL = device_url;
|
de.DeviceURL = device_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -641,7 +642,7 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
// priority = de.priority,
|
// priority = de.priority,
|
||||||
// status = de.status,
|
// status = de.status,
|
||||||
// DeviceURL = device_url,
|
// DeviceURL = device_url,
|
||||||
// icon_click = de.icon_click
|
// left_icon_click = de.left_icon_click
|
||||||
//};
|
//};
|
||||||
//afloor.device.Add(device);
|
//afloor.device.Add(device);
|
||||||
}
|
}
|
||||||
|
@ -581,8 +581,8 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
LENGTH(SUBSTRING_INDEX(errmsg, '_', -1) -1) -- 最後一段的長度
|
LENGTH(SUBSTRING_INDEX(errmsg, '_', -1) -1) -- 最後一段的長度
|
||||||
-1 -- 減掉最後的 _ ex:D3_B_B1F_CO_
|
-1 -- 減掉最後的 _ ex:D3_B_B1F_CO_
|
||||||
) device_tag
|
) device_tag
|
||||||
FROM alarmorion_orionalarmrecord a
|
FROM alarmOrion_OrionAlarmRecord a
|
||||||
JOIN alarmorion_orionalarmfacetvalue b on a.id = b.alarm
|
JOIN alarmOrion_OrionAlarmFacetValue b on a.id = b.alarm
|
||||||
WHERE a.sourceState = 1 and b.facetName = 9
|
WHERE a.sourceState = 1 and b.facetName = 9
|
||||||
) a
|
) a
|
||||||
left join device b on a.device_tag = b.device_number AND b.deleted = 0
|
left join device b on a.device_tag = b.device_number AND b.deleted = 0
|
||||||
@ -618,12 +618,12 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
|
|
||||||
|
|
||||||
var device_amount_sql = $@"SELECT
|
var device_amount_sql = $@"SELECT
|
||||||
d.building_guid,
|
d.device_building_tag,
|
||||||
COUNT(*) AS device_amount
|
COUNT(*) AS device_amount
|
||||||
FROM device d
|
FROM device d
|
||||||
WHERE d.deleted = 0
|
WHERE d.deleted = 0
|
||||||
AND d.device_number IN @devices
|
AND d.device_number IN @devices
|
||||||
GROUP BY d.building_guid";
|
GROUP BY d.device_building_tag";
|
||||||
alarmObj.buildingAlarmDeviceAmount = await frontendRepository.GetAllAsync<BuildingAlarmDeviceAmount>(device_amount_sql, new { devices = alarmObj.alarmorion.Select(x => x.device_number).ToList() });
|
alarmObj.buildingAlarmDeviceAmount = await frontendRepository.GetAllAsync<BuildingAlarmDeviceAmount>(device_amount_sql, new { devices = alarmObj.alarmorion.Select(x => x.device_number).ToList() });
|
||||||
|
|
||||||
apiResult.Data = alarmObj;
|
apiResult.Data = alarmObj;
|
||||||
|
@ -90,7 +90,7 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
Emergency_member_tables = await backendRepository.GetAllAsync<EmergencyContactTable>($@"
|
Emergency_member_tables = await backendRepository.GetAllAsync<EmergencyContactTable>($@"
|
||||||
select v.system_key groupingName,va.system_key departmentName,* from emergency_member em left join variable v on em.grouping = v.id
|
select v.system_key groupingName,va.system_key departmentName, em.* from emergency_member em left join variable v on em.grouping = v.id
|
||||||
left join (select * from variable vs where vs.system_type = 'department' and vs.deleted = 0) va on va.system_value = em.department
|
left join (select * from variable vs where vs.system_type = 'department' and vs.deleted = 0) va on va.system_value = em.department
|
||||||
where em.grouping in @groupinglist and em.deleted = 0", new { groupinglist = selectgroupidlist });
|
where em.grouping in @groupinglist and em.deleted = 0", new { groupinglist = selectgroupidlist });
|
||||||
apiResult.Code = "0000";
|
apiResult.Code = "0000";
|
||||||
@ -120,7 +120,7 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var Emergency_member_tables = await backendRepository.GetAllAsync<EmergencyContactTable>($@"
|
var Emergency_member_tables = await backendRepository.GetAllAsync<EmergencyContactTable>($@"
|
||||||
select v.system_key groupingName,va.system_key departmentName,* from emergency_member em left join variable v on em.grouping = v.id
|
select v.system_key groupingName,va.system_key departmentName, em.* from emergency_member em left join variable v on em.grouping = v.id
|
||||||
left join (select * from variable vs where vs.system_type = 'department' and vs.deleted = 0) va on va.system_value = em.department
|
left join (select * from variable vs where vs.system_type = 'department' and vs.deleted = 0) va on va.system_value = em.department
|
||||||
where em.grouping in @groupinglist and em.deleted = 0", new { groupinglist = post.groupidlist });
|
where em.grouping in @groupinglist and em.deleted = 0", new { groupinglist = post.groupidlist });
|
||||||
using (var doc = new Document())
|
using (var doc = new Document())
|
||||||
@ -236,7 +236,7 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var Emergency_member_tables = await backendRepository.GetAllAsync<EmergencyContactTable>($@"
|
var Emergency_member_tables = await backendRepository.GetAllAsync<EmergencyContactTable>($@"
|
||||||
select v.system_key groupingName,va.system_key departmentName,* from emergency_member em left join variable v on em.grouping = v.id
|
select v.system_key groupingName,va.system_key departmentName, em.* from emergency_member em left join variable v on em.grouping = v.id
|
||||||
left join (select * from variable vs where vs.system_type = 'department' and vs.deleted = 0) va on va.system_value = em.department
|
left join (select * from variable vs where vs.system_type = 'department' and vs.deleted = 0) va on va.system_value = em.department
|
||||||
where em.grouping in @groupinglist and em.deleted = 0", new { groupinglist = post.groupidlist });
|
where em.grouping in @groupinglist and em.deleted = 0", new { groupinglist = post.groupidlist });
|
||||||
var sheet = workbook.CreateSheet(post.disaster + "-聯絡清單");
|
var sheet = workbook.CreateSheet(post.disaster + "-聯絡清單");
|
||||||
|
@ -70,15 +70,15 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
List<BuildingToF> buildingToF = new List<BuildingToF>();
|
List<BuildingToF> buildingToF = new List<BuildingToF>();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var sqlString = @$"select f.floor_guid ,f.full_name floorname,b.building_guid,b.full_name buildingname from floor f left join building b on b.building_guid = f.building_guid order by f.building_guid , f.priority";
|
var sqlString = @$"select f.floor_guid ,f.full_name floorname,b.building_tag,b.full_name buildingname from floor f left join building b on b.building_tag = f.building_tag order by f.building_tag , f.priority";
|
||||||
Building_floor = await backendRepository.GetAllAsync<building_floor>(sqlString);
|
Building_floor = await backendRepository.GetAllAsync<building_floor>(sqlString);
|
||||||
|
|
||||||
var builds = Building_floor.GroupBy(a => a.building_guid).ToList();
|
var builds = Building_floor.GroupBy(a => a.building_tag).ToList();
|
||||||
foreach (var floor in builds)
|
foreach (var floor in builds)
|
||||||
{
|
{
|
||||||
BuildingToF buildingToF1 = new BuildingToF()
|
BuildingToF buildingToF1 = new BuildingToF()
|
||||||
{
|
{
|
||||||
building_guid = floor.Select(a => a.building_guid).FirstOrDefault(),
|
building_tag = floor.Select(a => a.building_tag).FirstOrDefault(),
|
||||||
building_name = floor.Select(a => a.buildingname).FirstOrDefault(),
|
building_name = floor.Select(a => a.buildingname).FirstOrDefault(),
|
||||||
floors = new List<FloorForB>()
|
floors = new List<FloorForB>()
|
||||||
};
|
};
|
||||||
@ -125,7 +125,7 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
d.device_guid,
|
d.device_guid,
|
||||||
d.device_number,
|
d.device_number,
|
||||||
d.full_name AS device_name,
|
d.full_name AS device_name,
|
||||||
d.building_guid,
|
d.device_building_tag,
|
||||||
b.full_name AS building_name,
|
b.full_name AS building_name,
|
||||||
CONCAT(b.ip_address , ':', b.ip_port) AS ip_address,
|
CONCAT(b.ip_address , ':', b.ip_port) AS ip_address,
|
||||||
v.layer2,
|
v.layer2,
|
||||||
@ -137,27 +137,27 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
floor.full_name floorname,
|
floor.full_name floorname,
|
||||||
floor.floor_guid floorguid
|
floor.floor_guid floorguid
|
||||||
from
|
from
|
||||||
(SELECT *
|
(SELECT *
|
||||||
FROM device d
|
FROM device d
|
||||||
WHERE d.deleted = 0
|
WHERE d.deleted = 0
|
||||||
AND d.building_guid = '{selectdevice.selectbuilding}'
|
AND d.device_building_tag = '{selectdevice.selectbuilding}'
|
||||||
AND d.floor_guid in @floor
|
AND d.device_floor_tag in @floor
|
||||||
AND d.device_system_category_layer3 IN @layer3) d
|
AND d.device_name_tag IN @layer3) d
|
||||||
left join floor on floor.floor_guid = d.floor_guid
|
left join floor on floor.full_name = d.device_floor_tag and floor.building_tag = d.device_building_tag
|
||||||
left join (
|
left join (
|
||||||
SELECT
|
SELECT
|
||||||
v.*,
|
v.*,
|
||||||
v2.system_key AS layer2_name,
|
v2.system_key AS layer2_name,
|
||||||
v2.system_value AS layer2
|
v2.system_value AS layer2
|
||||||
FROM (
|
FROM (
|
||||||
select *
|
select *
|
||||||
from variable v
|
from variable v
|
||||||
where v.system_type = 'device_system_category_layer3') v
|
where v.system_type = 'device_system_category_layer3') v
|
||||||
LEFT JOIN variable v2 ON v2.deleted = 0 AND v.system_parent_id = v2.id
|
LEFT JOIN variable v2 ON v2.deleted = 0 AND v.system_parent_id = v2.id
|
||||||
) v on v.system_value = d.device_system_category_layer3
|
) v on v.system_value = d.device_system_category_layer3
|
||||||
left join device_disaster dd on dd.device_guid = d.device_guid
|
left join device_disaster dd on dd.device_guid = d.device_guid
|
||||||
left join (select * from variable v where v.system_type = 'disaster') ddd on ddd.system_value = dd.device_system_value
|
left join (select * from variable v where v.system_type = 'disaster') ddd on ddd.system_value = dd.device_system_value
|
||||||
LEFT JOIN building b ON b.deleted = 0 AND d.building_guid = b.building_guid
|
LEFT JOIN building b ON b.deleted = 0 AND d.device_building_tag = b.building_tag
|
||||||
where dd.device_system_value IN @disasters
|
where dd.device_system_value IN @disasters
|
||||||
ORDER BY d.device_number
|
ORDER BY d.device_number
|
||||||
";
|
";
|
||||||
@ -194,7 +194,7 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
{
|
{
|
||||||
{"@emergency_event_guid",newguid},
|
{"@emergency_event_guid",newguid},
|
||||||
{"@disaster",eventpost.disaster},
|
{"@disaster",eventpost.disaster},
|
||||||
{"@building_guid", eventpost.build},
|
{"@building_tag", eventpost.build},
|
||||||
{"@device_guid",eventpost.device },
|
{"@device_guid",eventpost.device },
|
||||||
{"@type",eventpost.type}
|
{"@type",eventpost.type}
|
||||||
};
|
};
|
||||||
@ -267,7 +267,7 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
Emergency_Setting_tables = await backendRepository.GetAllAsync<EmergencySettingTable>($@"
|
Emergency_Setting_tables = await backendRepository.GetAllAsync<EmergencySettingTable>($@"
|
||||||
select v.system_key big_setting_name,* from emergency_setting es left join variable v on es.big_setting = v.id
|
select v.system_key big_setting_name,es.* from emergency_setting es left join variable v on es.big_setting = v.id
|
||||||
where es.big_setting = {selectsetting} and es.deleted = 0 order by es.priority");
|
where es.big_setting = {selectsetting} and es.deleted = 0 order by es.priority");
|
||||||
apiResult.Code = "0000";
|
apiResult.Code = "0000";
|
||||||
apiResult.Data = Emergency_Setting_tables;
|
apiResult.Data = Emergency_Setting_tables;
|
||||||
@ -296,7 +296,7 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var Emergency_Setting_tables = await backendRepository.GetOneAsync<EmergencyitemWithguid>($@"
|
var Emergency_Setting_tables = await backendRepository.GetOneAsync<EmergencyitemWithguid>($@"
|
||||||
select v.system_key big_setting_name,* from emergency_setting es left join variable v on es.big_setting = v.id
|
select v.system_key big_setting_name,es.* from emergency_setting es left join variable v on es.big_setting = v.id
|
||||||
where es.emergency_guid = '{post.emergency_guid}'");
|
where es.emergency_guid = '{post.emergency_guid}'");
|
||||||
|
|
||||||
if (post.make_item == 1)
|
if (post.make_item == 1)
|
||||||
@ -451,7 +451,7 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
Emergency_member_tables = await backendRepository.GetAllAsync<EmergencyContactTable>($@"
|
Emergency_member_tables = await backendRepository.GetAllAsync<EmergencyContactTable>($@"
|
||||||
select v.system_key groupingName,va.system_key departmentName,* from emergency_member em left join variable v on em.grouping = v.id
|
select v.system_key groupingName,va.system_key departmentName, em.* from emergency_member em left join variable v on em.grouping = v.id
|
||||||
left join (select * from variable vs where vs.system_type = 'department' and vs.deleted = 0) va on va.system_value = em.department
|
left join (select * from variable vs where vs.system_type = 'department' and vs.deleted = 0) va on va.system_value = em.department
|
||||||
where em.grouping in @groupinglist and em.deleted = 0", new { groupinglist = selectgroupidlist });
|
where em.grouping in @groupinglist and em.deleted = 0", new { groupinglist = selectgroupidlist });
|
||||||
apiResult.Code = "0000";
|
apiResult.Code = "0000";
|
||||||
@ -486,13 +486,16 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
getDeviceGroup = await backendRepository.GetAllAsync<EmergencyDeviceGroup>($@"
|
getDeviceGroup = await backendRepository.GetAllAsync<EmergencyDeviceGroup>($@"
|
||||||
select dg.*,vd.system_key disater_name,b.full_name building_name,f.full_name floor_name,v2.system_key system_category_layer2,v3.system_key system_category_layer3 from (SELECT * FROM device_group dg WHERE dg.device_disaster != 0) dg
|
select dg.*,vd.system_key disater_name,b.full_name building_name,f.full_name floor_name,v2.system_key system_category_layer2,v3.system_key system_category_layer3
|
||||||
left join (select * from variable v where v.system_type = 'disaster' and v.deleted = 0) vd on vd.system_value = dg.device_disaster
|
from (
|
||||||
left join building b on b.building_guid = dg.device_building_guid
|
SELECT *
|
||||||
left join floor f on f.floor_guid = dg.device_floor_guid
|
FROM device_group dg WHERE dg.device_disaster != 0) dg
|
||||||
left join (select * from variable v where v.system_type = 'device_system_category_layer2' and v.deleted = 0) v2 on v2.system_value = dg.device_system_category_layer2
|
left join (select * from variable v where v.system_type = 'disaster' and v.deleted = 0) vd on vd.system_value = dg.device_disaster
|
||||||
left join (select * from variable v where v.system_type = 'device_system_category_layer3' and v.deleted = 0) v3 on v3.system_value = dg.device_system_category_layer3
|
left join building b on b.building_tag = dg.device_building_tag
|
||||||
order by vd.system_priority,b.priority,f.priority,v2.system_priority,v3.system_priority");
|
left join floor f on f.floor_guid = dg.device_floor_guid
|
||||||
|
left join (select * from variable v where v.system_type = 'device_system_category_layer2' and v.deleted = 0) v2 on v2.system_value = dg.device_system_category_layer2
|
||||||
|
left join (select * from variable v where v.system_type = 'device_system_category_layer3' and v.deleted = 0) v3 on v3.system_value = dg.device_system_category_layer3
|
||||||
|
order by vd.system_priority,b.priority,f.priority,v2.system_priority,v3.system_priority");
|
||||||
|
|
||||||
var dis = getDeviceGroup.GroupBy(a => a.device_disaster);
|
var dis = getDeviceGroup.GroupBy(a => a.device_disaster);
|
||||||
//finalDeviceGroup.disaster = new List<KeyValue>();
|
//finalDeviceGroup.disaster = new List<KeyValue>();
|
||||||
@ -504,13 +507,13 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
Name = diss.Select(a => a.disater_name).FirstOrDefault().ToString(),
|
Name = diss.Select(a => a.disater_name).FirstOrDefault().ToString(),
|
||||||
groupBuildings = new List<GroupBuildings>()
|
groupBuildings = new List<GroupBuildings>()
|
||||||
};
|
};
|
||||||
var buds = diss.GroupBy(a => a.device_building_guid);
|
var buds = diss.GroupBy(a => a.device_building_tag);
|
||||||
getDeviceGroup1.groupBuildings = new List<GroupBuildings>();
|
getDeviceGroup1.groupBuildings = new List<GroupBuildings>();
|
||||||
foreach (var bud in buds)
|
foreach (var bud in buds)
|
||||||
{
|
{
|
||||||
GroupBuildings groupBuildings = new GroupBuildings()
|
GroupBuildings groupBuildings = new GroupBuildings()
|
||||||
{
|
{
|
||||||
guid = bud.Key,
|
tag = bud.Key,
|
||||||
name = bud.Select(a => a.building_name).FirstOrDefault().ToString(),
|
name = bud.Select(a => a.building_name).FirstOrDefault().ToString(),
|
||||||
device_amount = 0,
|
device_amount = 0,
|
||||||
groupFloors = new List<GroupFloor>()
|
groupFloors = new List<GroupFloor>()
|
||||||
|
@ -35,7 +35,7 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var sqlString = @$"select building_guid as Value, full_name as Name from building a where a.deleted = 0 and a.status = 0";
|
var sqlString = @$"select building_tag as Value, full_name as Name from building a where a.deleted = 0 and a.status = 0";
|
||||||
KeyValue = await backendRepository.GetAllAsync<KeyValue>(sqlString);
|
KeyValue = await backendRepository.GetAllAsync<KeyValue>(sqlString);
|
||||||
|
|
||||||
apiResult.Code = "0000";
|
apiResult.Code = "0000";
|
||||||
@ -74,8 +74,8 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
select d.device_number device_name,v.system_key disaster_name,ee.*,b.full_name building_name from emergency_event ee
|
select d.device_number device_name,v.system_key disaster_name,ee.*,b.full_name building_name from emergency_event ee
|
||||||
left join (select * from variable v where v.system_type = 'disaster') v on v.system_value = ee.disaster
|
left join (select * from variable v where v.system_type = 'disaster') v on v.system_value = ee.disaster
|
||||||
left join device d on d.device_guid = ee.device_guid
|
left join device d on d.device_guid = ee.device_guid
|
||||||
left join building b on b.building_guid = ee.building_guid
|
left join building b on b.building_tag = ee.building_tag
|
||||||
where ee.deleted = 0 and ee.building_guid = '{post.selectaBuild}' and ee.disaster = '{post.selectaDisaster}' {sqlplus}
|
where ee.deleted = 0 and ee.building_tag = '{post.selectaBuild}' and ee.disaster = '{post.selectaDisaster}' {sqlplus}
|
||||||
");
|
");
|
||||||
apiResult.Code = "0000";
|
apiResult.Code = "0000";
|
||||||
apiResult.Data = EmergencyRecordEvent;
|
apiResult.Data = EmergencyRecordEvent;
|
||||||
|
@ -825,7 +825,7 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
|
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
|
||||||
return Ok(apiResult);
|
return Ok(apiResult);
|
||||||
}
|
}
|
||||||
|
apiResult.Code = "0000";
|
||||||
return Ok(apiResult);
|
return Ok(apiResult);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1118,27 +1118,27 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
{
|
{
|
||||||
//依據被選擇的設備找出相對應資料
|
//依據被選擇的設備找出相對應資料
|
||||||
var sqlDeviceItemInfo = $@"select
|
var sqlDeviceItemInfo = $@"select
|
||||||
b.full_name as building_name,
|
b.full_name as building_name,
|
||||||
v1.system_key as Main_system_name,
|
v1.system_key as Main_system_name,
|
||||||
v2.system_key as Sub_system_name,
|
v2.system_key as Sub_system_name,
|
||||||
temp.device_number,
|
temp.device_number,
|
||||||
temp.device_name,
|
temp.device_name,
|
||||||
temp.full_name as item_name,
|
temp.full_name as item_name,
|
||||||
temp.points,
|
temp.points,
|
||||||
temp.unit
|
temp.unit
|
||||||
from (
|
from (
|
||||||
select
|
select
|
||||||
di.*,
|
di.*,
|
||||||
d.device_number,
|
d.device_number,
|
||||||
d.full_name as device_name,
|
d.full_name as device_name,
|
||||||
d.priority
|
d.priority
|
||||||
from device_item di
|
from device_item di
|
||||||
inner join device d on di.device_building_tag COLLATE utf8mb4_unicode_ci = d.device_building_tag
|
inner join device d on di.device_building_tag COLLATE utf8mb4_unicode_ci = d.device_building_tag
|
||||||
and di.device_system_tag COLLATE utf8mb4_unicode_ci = d.device_system_tag
|
and di.device_system_tag COLLATE utf8mb4_unicode_ci = d.device_system_tag
|
||||||
and di.device_name_tag COLLATE utf8mb4_unicode_ci = d.device_name_tag
|
and di.device_name_tag COLLATE utf8mb4_unicode_ci = d.device_name_tag
|
||||||
and d.deleted = 0
|
and d.deleted = 0
|
||||||
where di.deleted = 0 and di.unit is not null and d.device_number IN @Device_number
|
where di.deleted = 0 and di.unit is not null and d.device_number = @Device_number
|
||||||
) temp
|
) temp
|
||||||
inner join building b on temp.device_building_tag COLLATE utf8mb4_unicode_ci = b.building_tag and b.deleted = 0
|
inner join building b on temp.device_building_tag COLLATE utf8mb4_unicode_ci = b.building_tag and b.deleted = 0
|
||||||
inner join variable v1 on temp.device_system_tag COLLATE utf8mb4_unicode_ci = v1.system_value and v1.deleted = 0 and v1.system_type = 'device_system_category_layer2'
|
inner join variable v1 on temp.device_system_tag COLLATE utf8mb4_unicode_ci = v1.system_value and v1.deleted = 0 and v1.system_type = 'device_system_category_layer2'
|
||||||
inner join variable v2 on temp.device_name_tag COLLATE utf8mb4_unicode_ci = v2.system_value and v2.deleted = 0 and v2.system_type = 'device_system_category_layer3'
|
inner join variable v2 on temp.device_name_tag COLLATE utf8mb4_unicode_ci = v2.system_value and v2.deleted = 0 and v2.system_type = 'device_system_category_layer3'
|
||||||
@ -1151,7 +1151,7 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
var tableName = await backgroundServiceMsSqlRepository.GetOneAsync<string>($"select table_name from INFORMATION_SCHEMA.TABLES where table_name like '%{device_number}_{point}%'");
|
var tableName = await backgroundServiceMsSqlRepository.GetOneAsync<string>($"select table_name from INFORMATION_SCHEMA.TABLES where table_name like '%{device_number}_{point}%'");
|
||||||
if (!string.IsNullOrEmpty(tableName))
|
if (!string.IsNullOrEmpty(tableName))
|
||||||
{
|
{
|
||||||
var device_item_infos = await frontendRepository.GetAllAsync<DeviceItemInfo>(sqlDeviceItemInfo, new { Device_number = hi.Device_number_point });
|
var device_item_infos = await frontendRepository.GetAllAsync<DeviceItemInfo>(sqlDeviceItemInfo, new { Device_number = device_number });
|
||||||
|
|
||||||
var device_item_info = device_item_infos.Where(x => x.Device_number == device_number && x.Points == point).FirstOrDefault();
|
var device_item_info = device_item_infos.Where(x => x.Device_number == device_number && x.Points == point).FirstOrDefault();
|
||||||
|
|
||||||
@ -1170,7 +1170,7 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
//{
|
//{
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
apiResult.Code = "0000";
|
||||||
apiResult.Data = apiResult.Data.OrderBy(x => x.Device_number).ThenBy(x => x.Timestamp).ToList();
|
apiResult.Data = apiResult.Data.OrderBy(x => x.Device_number).ThenBy(x => x.Timestamp).ToList();
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
|
@ -87,6 +87,8 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
|
|
||||||
var table = input.tableType == "year" ? "archive_electric_meter_day" : "archive_electric_meter_" + input.tableType;
|
var table = input.tableType == "year" ? "archive_electric_meter_day" : "archive_electric_meter_" + input.tableType;
|
||||||
var dateFormat = input.tableType == "day" || input.tableType == "week" ? "%Y-%m-%d" : input.tableType == "month" ? "%Y-%m" : input.tableType == "year" ? "%Y" : null;
|
var dateFormat = input.tableType == "day" || input.tableType == "week" ? "%Y-%m-%d" : input.tableType == "month" ? "%Y-%m" : input.tableType == "year" ? "%Y" : null;
|
||||||
|
var aemmEndDate = input.tableType == "year" ? $"year(DATE_ADD(fd.date, INTERVAL +1 {input.tableType}))" : $"DATE_ADD(fd.date, INTERVAL +1 {input.tableType})";
|
||||||
|
var aemmStaDate = input.tableType == "year" ? "year(fd.date)" : "fd.date";
|
||||||
var sql = $@"set @i = -1;
|
var sql = $@"set @i = -1;
|
||||||
select fd.device_number, aemm.avg_rawdata, DATE_FORMAT(fd.date, @dateFormat) as timestamp
|
select fd.device_number, aemm.avg_rawdata, DATE_FORMAT(fd.date, @dateFormat) as timestamp
|
||||||
from (
|
from (
|
||||||
@ -111,7 +113,7 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
from {table}
|
from {table}
|
||||||
where start_timestamp >= @startTime and end_timestamp < @endTime and point = 'KWH' and SUBSTRING_INDEX(device_number, '_', 1) = @building_tag
|
where start_timestamp >= @startTime and end_timestamp < @endTime and point = 'KWH' and SUBSTRING_INDEX(device_number, '_', 1) = @building_tag
|
||||||
{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,
|
||||||
new { startTime = startTime, endtime = endTime, building_tag = input.building_tag, floor_tag = input.floor_tag, dateFormat = dateFormat });
|
new { startTime = startTime, endtime = endTime, building_tag = input.building_tag, floor_tag = input.floor_tag, dateFormat = dateFormat });
|
||||||
|
@ -58,8 +58,8 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
ControllerContext.HttpContext.Response.Headers.Add("Access-Control-Allow-Origin", "*");
|
ControllerContext.HttpContext.Response.Headers.Add("Access-Control-Allow-Origin", "*");
|
||||||
EDFunction eDFunction = new EDFunction();
|
EDFunction eDFunction = new EDFunction();
|
||||||
|
|
||||||
string SHA256Pwd = eDFunction.GetSHA256Encryption(login.password);
|
//string SHA256Pwd = eDFunction.GetSHA256Encryption(login.password);
|
||||||
var User = await backendRepository.GetOneAsync<User>("userinfo", @$"account = '{login.account}' and password = '{SHA256Pwd}' and deleted = 0");
|
var User = await backendRepository.GetOneAsync<User>("userinfo", @$"account = '{login.account}' and deleted = 0");
|
||||||
if (User == null)
|
if (User == null)
|
||||||
{
|
{
|
||||||
apiResult.Code = "9998";
|
apiResult.Code = "9998";
|
||||||
|
@ -33,7 +33,7 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var sqlString = @$"select floor_guid as Value, full_name as Name from floor a where a.deleted = 0 and a.building_guid = '{Building}' and a.status = 0 order by a.priority";
|
var sqlString = @$"select floor_guid as Value, full_name as Name from floor a where a.deleted = 0 and a.building_tag = '{Building}' and a.status = 0 order by a.priority";
|
||||||
KeyValue = await backendRepository.GetAllAsync<KeyValue>(sqlString);
|
KeyValue = await backendRepository.GetAllAsync<KeyValue>(sqlString);
|
||||||
|
|
||||||
apiResult.Code = "0000";
|
apiResult.Code = "0000";
|
||||||
@ -61,7 +61,7 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
ApiResult<List<RescueDeviceTable>> apiResult = new ApiResult<List<RescueDeviceTable>>();
|
ApiResult<List<RescueDeviceTable>> apiResult = new ApiResult<List<RescueDeviceTable>>();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
RescueDeviceTables = await backendRepository.GetAllAsync<RescueDeviceTable>("rescue_device", $"building_guid = '{post.build}' and floor_guid in @floors and rescue_device_kind = {post.kind}", new { floors = post.floors }, "floor_name");
|
RescueDeviceTables = await backendRepository.GetAllAsync<RescueDeviceTable>("rescue_device", $"building_tag = '{post.build}' and floor_guid in @floors and rescue_device_kind = {post.kind}", new { floors = post.floors }, "floor_name");
|
||||||
apiResult.Code = "0000";
|
apiResult.Code = "0000";
|
||||||
apiResult.Data = RescueDeviceTables;
|
apiResult.Data = RescueDeviceTables;
|
||||||
}
|
}
|
||||||
@ -88,7 +88,7 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var sqlString = @$"select building_guid as Value, full_name as Name from building a where a.deleted = 0 and a.status = 0 ORDER BY A.priority ASC, A.created_at DESC";
|
var sqlString = @$"select building_tag as Value, full_name as Name from building a where a.deleted = 0 and a.status = 0 ORDER BY a.priority ASC, a.created_at DESC";
|
||||||
KeyValue = await backendRepository.GetAllAsync<KeyValue>(sqlString);
|
KeyValue = await backendRepository.GetAllAsync<KeyValue>(sqlString);
|
||||||
|
|
||||||
apiResult.Code = "0000";
|
apiResult.Code = "0000";
|
||||||
@ -159,7 +159,7 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
devicename = "AED";
|
devicename = "AED";
|
||||||
}
|
}
|
||||||
var sheet = workbook.CreateSheet(devicename);
|
var sheet = workbook.CreateSheet(devicename);
|
||||||
var RescueDevices = backendRepository.GetAllAsync<RescueDevice>("rescue_device", $"building_guid = '{postObject.build}' and rescue_device_kind = {postObject.kind}",null, "floor_name");
|
var RescueDevices = backendRepository.GetAllAsync<RescueDevice>("rescue_device", $"building_tag = '{postObject.build}' and rescue_device_kind = {postObject.kind}",null, "floor_name");
|
||||||
int RowPosition = 0;
|
int RowPosition = 0;
|
||||||
IRow row = sheet.CreateRow(RowPosition);
|
IRow row = sheet.CreateRow(RowPosition);
|
||||||
ICell cell = row.CreateCell(1);
|
ICell cell = row.CreateCell(1);
|
||||||
|
31
FrontendWebApi/Controllers/EmergencyContactController.cs
Normal file
31
FrontendWebApi/Controllers/EmergencyContactController.cs
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
using FrontendWebApi.Models;
|
||||||
|
using iTextSharp.text;
|
||||||
|
using iTextSharp.text.html.simpleparser;
|
||||||
|
using iTextSharp.text.pdf;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using NPOI.SS.UserModel;
|
||||||
|
using NPOI.XSSF.UserModel;
|
||||||
|
using Repository.BackendRepository.Interface;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace FrontendWebApi.Controllers
|
||||||
|
{
|
||||||
|
public class EmergencyContactController : MyBaseController<EmergencyContactController>
|
||||||
|
{
|
||||||
|
private readonly IBackendRepository backendRepository;
|
||||||
|
public EmergencyContactController(IBackendRepository backendRepository)
|
||||||
|
{
|
||||||
|
this.backendRepository = backendRepository;
|
||||||
|
}
|
||||||
|
public IActionResult Index()
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
24
FrontendWebApi/Controllers/EmergencyDeviceMenuController.cs
Normal file
24
FrontendWebApi/Controllers/EmergencyDeviceMenuController.cs
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace FrontendWebApi.Controllers
|
||||||
|
{
|
||||||
|
public class EmergencyDeviceMenuController : MyBaseController<EmergencyDeviceMenuController>
|
||||||
|
{
|
||||||
|
private readonly ILogger<EmergencyDeviceMenuController> _logger;
|
||||||
|
|
||||||
|
public EmergencyDeviceMenuController(ILogger<EmergencyDeviceMenuController> logger)
|
||||||
|
{
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IActionResult Index()
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
48
FrontendWebApi/Controllers/EmergencyRecordController.cs
Normal file
48
FrontendWebApi/Controllers/EmergencyRecordController.cs
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
using FrontendWebApi.Models;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Repository.BackendRepository.Interface;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace FrontendWebApi.Controllers
|
||||||
|
{
|
||||||
|
public class EmergencyRecordController : MyBaseController<EmergencyRecordController>
|
||||||
|
{
|
||||||
|
private readonly IBackendRepository backendRepository;
|
||||||
|
public EmergencyRecordController(IBackendRepository backendRepository)
|
||||||
|
{
|
||||||
|
this.backendRepository = backendRepository;
|
||||||
|
}
|
||||||
|
public IActionResult Index()
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<ApiResult<List<KeyValue>>> DisasterList()
|
||||||
|
{
|
||||||
|
ApiResult<List<KeyValue>> apiResult = new ApiResult<List<KeyValue>>();
|
||||||
|
List<KeyValue> Variable = new List<KeyValue>();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var sqlString = @$"select system_value as Value, system_key as Name from variable a where a.system_type = 'disaster' and a.deleted = 0";
|
||||||
|
Variable = await backendRepository.GetAllAsync<KeyValue>(sqlString);
|
||||||
|
|
||||||
|
apiResult.Code = "0000";
|
||||||
|
apiResult.Data = Variable;
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
apiResult.Code = "9999";
|
||||||
|
apiResult.Msg = "系統內部錯誤,請聯絡管理者。";
|
||||||
|
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
return apiResult;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
25
FrontendWebApi/Controllers/HomeController.cs
Normal file
25
FrontendWebApi/Controllers/HomeController.cs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace FrontendWebApi.Controllers
|
||||||
|
{
|
||||||
|
public class HomeController : MyBaseController<HomeController>
|
||||||
|
{
|
||||||
|
private readonly ILogger<HomeController> _logger;
|
||||||
|
|
||||||
|
public HomeController(ILogger<HomeController> logger)
|
||||||
|
{
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IActionResult Index()
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
55
FrontendWebApi/Controllers/LoginController.cs
Normal file
55
FrontendWebApi/Controllers/LoginController.cs
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
using FrontendWebApi.Jwt;
|
||||||
|
using FrontendWebApi.Models;
|
||||||
|
using iTextSharp.text;
|
||||||
|
using iTextSharp.text.pdf;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using NPOI.SS.UserModel;
|
||||||
|
using NPOI.XSSF.UserModel;
|
||||||
|
using Repository.BackendRepository.Interface;
|
||||||
|
using Repository.FrontendRepository.Interface;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace FrontendWebApi.Controllers
|
||||||
|
{
|
||||||
|
public class LoginController : Controller
|
||||||
|
{
|
||||||
|
private readonly ILogger<LoginController> logger;
|
||||||
|
private readonly IBackendRepository backendRepository;
|
||||||
|
private readonly IFrontendRepository frontendRepository;
|
||||||
|
private readonly IJwtHelpers jwt;
|
||||||
|
//string jwt_str = "login";
|
||||||
|
protected MyUserInfo myUserInfo = null;
|
||||||
|
protected JwtGet myUser;
|
||||||
|
protected string jwt_str = null;
|
||||||
|
protected bool jwtlife = true;
|
||||||
|
|
||||||
|
public LoginController
|
||||||
|
(
|
||||||
|
ILogger<LoginController> logger,
|
||||||
|
IBackendRepository backendRepository,
|
||||||
|
IFrontendRepository frontendRepository,
|
||||||
|
IJwtHelpers jwt
|
||||||
|
)
|
||||||
|
{
|
||||||
|
this.logger = logger;
|
||||||
|
this.jwt = jwt;
|
||||||
|
this.backendRepository = backendRepository;
|
||||||
|
this.frontendRepository = frontendRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IActionResult Index(string jwt)
|
||||||
|
{
|
||||||
|
ViewBag.jwt = jwt;
|
||||||
|
ViewBag.ProjectName = backendRepository.GetOneAsync<string>("select system_key from variable where deleted = 0 and system_type = 'project_name';").Result;
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
166
FrontendWebApi/Controllers/MyBaseController.cs
Normal file
166
FrontendWebApi/Controllers/MyBaseController.cs
Normal file
@ -0,0 +1,166 @@
|
|||||||
|
using FrontendWebApi.Jwt;
|
||||||
|
using FrontendWebApi.Models;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.AspNetCore.Mvc.Filters;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using Repository.BackendRepository.Interface;
|
||||||
|
using Repository.BaseRepository.Interface;
|
||||||
|
using Repository.FrontendRepository.Interface;
|
||||||
|
using Repository.Helper;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Microsoft.AspNetCore.Routing;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using Repository.BackendRepository.Implement;
|
||||||
|
|
||||||
|
namespace FrontendWebApi.Controllers
|
||||||
|
{
|
||||||
|
public class MyBaseController<T> : Controller where T : MyBaseController<T>
|
||||||
|
{
|
||||||
|
private ILogger<T> _logger;
|
||||||
|
protected ILogger<T> Logger => _logger ?? (_logger = HttpContext?.RequestServices.GetService<ILogger<T>>());
|
||||||
|
private IJwtHelpers jwt => HttpContext?.RequestServices.GetService<IJwtHelpers>();
|
||||||
|
private IFrontendRepository frontendRepository => HttpContext?.RequestServices.GetService<IFrontendRepository>();
|
||||||
|
|
||||||
|
public MyBaseController() { }
|
||||||
|
protected MyUserInfo myUserInfo = null;
|
||||||
|
protected JwtGet myUser;
|
||||||
|
protected string jwt_str = null;
|
||||||
|
protected bool jwtlife = true;
|
||||||
|
public string controllerName;
|
||||||
|
public string actionName;
|
||||||
|
public ErrorCode errorCode = new ErrorCode();
|
||||||
|
[Authorize]
|
||||||
|
public override void OnActionExecuting(ActionExecutingContext filterContext)
|
||||||
|
{
|
||||||
|
EDFunction edFunction = new EDFunction();
|
||||||
|
var myAccount = edFunction.AESDecrypt(HttpContext.Session.GetString("MyApiAccount"));
|
||||||
|
controllerName = ControllerContext.RouteData.Values["controller"].ToString(); //controller名稱
|
||||||
|
actionName = ControllerContext.RouteData.Values["action"].ToString(); //action名稱
|
||||||
|
|
||||||
|
//紀錄當前PID
|
||||||
|
Process currentProcess = Process.GetCurrentProcess();
|
||||||
|
Dictionary<string, object> updateProcess = new Dictionary<string, object>();
|
||||||
|
updateProcess.Add("@system_value", currentProcess.Id.ToString());
|
||||||
|
|
||||||
|
frontendRepository.UpdateProcessPID(updateProcess, "variable", "system_type = 'watchDogCongfig' AND system_key = 'AlarmPID'");
|
||||||
|
|
||||||
|
bool isAjaxCall = filterContext.HttpContext.Request.Headers["x-requested-with"] == "XMLHttpRequest";
|
||||||
|
if (string.IsNullOrEmpty(myAccount))
|
||||||
|
{
|
||||||
|
|
||||||
|
if (isAjaxCall)
|
||||||
|
{
|
||||||
|
filterContext.HttpContext.Response.Clear();
|
||||||
|
filterContext.HttpContext.Response.StatusCode = 499;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
filterContext.Result = new RedirectToRouteResult(
|
||||||
|
new RouteValueDictionary
|
||||||
|
{
|
||||||
|
{"controller", "Login"},
|
||||||
|
{"action", "Index"}
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//取得當前登入使用者資訊
|
||||||
|
myUserInfo = frontendRepository.GetMyUserInfoByAccount<MyUserInfo>(myAccount);
|
||||||
|
var showview = frontendRepository.GetAllAsync<string>($@"select ap.ShowView from userinfo us
|
||||||
|
left join role_auth ra on ra.role_guid = us.role_guid
|
||||||
|
left join auth_page ap on ap.AuthCode = ra.AuthCode
|
||||||
|
where us.userinfo_guid = '{myUserInfo.Userinfo_guid}'");
|
||||||
|
myUserInfo.ShowView = showview.Result;
|
||||||
|
ViewBag.myUserInfo = myUserInfo;
|
||||||
|
ViewBag.role = showview.Result;
|
||||||
|
|
||||||
|
//var showviewt = new List<string>()
|
||||||
|
// {
|
||||||
|
// "EmergencyDeviceMenuIndex",
|
||||||
|
// "EmergencyContactIndex",
|
||||||
|
// "EmergencyRecordIndex",
|
||||||
|
// "RescueDeviceFireExtinguisher",
|
||||||
|
// "RescueDeviceAED",
|
||||||
|
// };
|
||||||
|
//ViewBag.role = showviewt;
|
||||||
|
}
|
||||||
|
|
||||||
|
//var ctx = filterContext.HttpContext;
|
||||||
|
//ctx.Response.Headers.Add("Access-Control-Allow-Origin", "*");
|
||||||
|
//ctx.Response.Headers.Add("Access-Control-Allow-Headers", "*");
|
||||||
|
//ctx.Response.Headers.Add("Access-Control-Allow-Credentials", "true");
|
||||||
|
//var a = User.Claims.Select(p => new { Type = p.Type, Value = p.Value }).ToList();
|
||||||
|
//myUser = new JwtGet()
|
||||||
|
//{
|
||||||
|
// account = User.Claims.Where(a => a.Type == "account").Select(e => e.Value).FirstOrDefault(),
|
||||||
|
// email = User.Claims.Where(a => a.Type == "email").Select(e => e.Value).FirstOrDefault(),
|
||||||
|
// full_name = User.Claims.Where(a => a.Type == "full_name").Select(e => e.Value).FirstOrDefault(),
|
||||||
|
// exp = User.Claims.Where(a => a.Type == "exp").Select(e => Convert.ToInt32(e.Value)).FirstOrDefault(),
|
||||||
|
// nbf = User.Claims.Where(a => a.Type == "nbf").Select(e => Convert.ToInt32(e.Value)).FirstOrDefault(),
|
||||||
|
// userinfo_guid = User.Claims.Where(a => a.Type == "userinfo_guid").Select(e => e.Value).FirstOrDefault(),
|
||||||
|
//};
|
||||||
|
|
||||||
|
//TODO 模擬JWT,記得刪除
|
||||||
|
//myUser.account = "Bajascript";
|
||||||
|
//myUser.email = "asd@com";
|
||||||
|
//myUser.full_name = "野原廣志";
|
||||||
|
//myUser.exp = 3600;
|
||||||
|
//myUser.userinfo_guid = "1EF9CEAC-4DBF-E2BE-8B1D-CB3014E0DA17";
|
||||||
|
|
||||||
|
//if (myUser.exp == 0)
|
||||||
|
//{
|
||||||
|
// jwt_str = "Jwt Token不合法";
|
||||||
|
// jwtlife = false;
|
||||||
|
|
||||||
|
// ViewBag.myUserInfo = null;
|
||||||
|
// ViewBag.role = null;
|
||||||
|
//}
|
||||||
|
//else
|
||||||
|
//{
|
||||||
|
// if (myUser.exp <= DateTime.Now.AddHours(-8).AddMinutes(10).Subtract(new DateTime(1970, 1, 1)).TotalSeconds)
|
||||||
|
// {
|
||||||
|
// //取得當前登入使用者資訊
|
||||||
|
// myUserInfo = frontendRepository.GetMyUserInfoByAccount<MyUserInfo>(myUser.account);
|
||||||
|
// //var showview = frontendRepository.GetAllAsync<string>($@"select ap.ShowView from userinfo us
|
||||||
|
// // left join role_auth ra on ra.role_guid = us.role_guid
|
||||||
|
// // left join auth_page ap on ap.AuthCode = ra.AuthCode
|
||||||
|
// // where us.userinfo_guid = '{myUserInfo.Userinfo_guid}'");
|
||||||
|
// //myUserInfo.ShowView = showview.Result;
|
||||||
|
// ViewBag.myUserInfo = myUserInfo;
|
||||||
|
|
||||||
|
// var showviewt = new List<string>()
|
||||||
|
// {
|
||||||
|
// "EmergencyDeviceMenuIndex",
|
||||||
|
// "EmergencyContactIndex",
|
||||||
|
// "EmergencyRecordIndex",
|
||||||
|
// "RescueDeviceFireExtinguisher",
|
||||||
|
// "RescueDeviceAED",
|
||||||
|
// };
|
||||||
|
// //ViewBag.role = showview.Result;
|
||||||
|
// ViewBag.role = showviewt;
|
||||||
|
|
||||||
|
// jwtlife = true;
|
||||||
|
// JwtLogin jwtLoing = new JwtLogin()
|
||||||
|
// {
|
||||||
|
// account = myUser.account,
|
||||||
|
// email = myUser.email,
|
||||||
|
// full_name = myUser.full_name,
|
||||||
|
// userinfo_guid = myUser.userinfo_guid
|
||||||
|
// };
|
||||||
|
// jwt_str = jwt.GenerateToken(jwtLoing).token;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
base.OnActionExecuting(filterContext);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
34
FrontendWebApi/Controllers/RescueDeviceController.cs
Normal file
34
FrontendWebApi/Controllers/RescueDeviceController.cs
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using NPOI.HSSF.UserModel;
|
||||||
|
using NPOI.SS.UserModel;
|
||||||
|
using NPOI.XSSF.UserModel;
|
||||||
|
using Repository.BackendRepository.Interface;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace FrontendWebApi.Controllers
|
||||||
|
{
|
||||||
|
public class RescueDeviceController : MyBaseController<RescueDeviceController>
|
||||||
|
{
|
||||||
|
private readonly IBackendRepository backendRepository;
|
||||||
|
|
||||||
|
public RescueDeviceController(IBackendRepository backendRepository)
|
||||||
|
{
|
||||||
|
this.backendRepository = backendRepository;
|
||||||
|
}
|
||||||
|
public IActionResult FireExtinguisher()
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
public IActionResult AED()
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -8,23 +8,23 @@ namespace FrontendWebApi.Models
|
|||||||
{
|
{
|
||||||
public class AlarmRecordPanelRawData
|
public class AlarmRecordPanelRawData
|
||||||
{
|
{
|
||||||
public string building_guid { get; set; }
|
public string building_tag { get; set; }
|
||||||
public string building_name { get; set; }
|
public string building_name { get; set; }
|
||||||
public string main_system_guid { get; set; }
|
public string system_key { get; set; }
|
||||||
public string main_system_name { get; set; }
|
public string system_value { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
public class AlarmRecordPanel
|
public class AlarmRecordPanel
|
||||||
{
|
{
|
||||||
public string building_guid { get; set; }
|
public string building_tag { get; set; }
|
||||||
public string building_name { get; set; }
|
public string building_name { get; set; }
|
||||||
public List<MainSystemPanel> mainSystemPanels { get; set; }
|
public List<MainSystemPanel> mainSystemPanels { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class MainSystemPanel
|
public class MainSystemPanel
|
||||||
{
|
{
|
||||||
public string main_system_guid { get; set; }
|
public string system_key { get; set; }
|
||||||
public string main_system_name { get; set; }
|
public string system_value { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class AlarmRecord
|
public class AlarmRecord
|
||||||
@ -52,8 +52,8 @@ namespace FrontendWebApi.Models
|
|||||||
{
|
{
|
||||||
public string StartTimestamp { get; set; }
|
public string StartTimestamp { get; set; }
|
||||||
public string EndTimestamp { get; set; }
|
public string EndTimestamp { get; set; }
|
||||||
public string Building_guid { get; set; }
|
public string Building_tag { get; set; }
|
||||||
public List<string> Main_system_guids { get; set; }
|
public List<string> Main_system_tag { get; set; }
|
||||||
public byte IsSolve { get;set;}
|
public byte IsSolve { get;set;}
|
||||||
public byte IsAck { get;set;}
|
public byte IsAck { get;set;}
|
||||||
}
|
}
|
||||||
|
@ -186,10 +186,10 @@ namespace FrontendWebApi.Models
|
|||||||
public byte device_error_flashing { get; set; }
|
public byte device_error_flashing { get; set; }
|
||||||
public byte device_error_independent { get; set; }
|
public byte device_error_independent { get; set; }
|
||||||
public int priority { get; set; }
|
public int priority { get; set; }
|
||||||
public byte icon_click { get; set; }
|
public byte left_icon_click { get; set; }
|
||||||
public string icon_click_url { get; set; }
|
public string left_icon_click_url { get; set; }
|
||||||
public int icon_click_url_width { get; set; }
|
public int left_icon_click_url_width { get; set; }
|
||||||
public int icon_click_url_height { get; set; }
|
public int left_icon_click_url_height { get; set; }
|
||||||
public string DeviceURL { get; set; }
|
public string DeviceURL { get; set; }
|
||||||
public string point_name { get; set; }
|
public string point_name { get; set; }
|
||||||
public string points { get; set; }
|
public string points { get; set; }
|
||||||
|
@ -8,7 +8,7 @@ namespace FrontendWebApi.Models
|
|||||||
public class EmergencyDeviceGroup
|
public class EmergencyDeviceGroup
|
||||||
{
|
{
|
||||||
public string device_disaster { get; set; }
|
public string device_disaster { get; set; }
|
||||||
public string device_building_guid { get; set; }
|
public string device_building_tag { get; set; }
|
||||||
public string device_floor_guid { get; set; }
|
public string device_floor_guid { get; set; }
|
||||||
public string device_system_category_layer2 { get; set; }
|
public string device_system_category_layer2 { get; set; }
|
||||||
public string device_system_category_layer3 { get; set; }
|
public string device_system_category_layer3 { get; set; }
|
||||||
@ -35,7 +35,7 @@ namespace FrontendWebApi.Models
|
|||||||
|
|
||||||
public class GroupBuildings
|
public class GroupBuildings
|
||||||
{
|
{
|
||||||
public string guid { get; set; }
|
public string tag { get; set; }
|
||||||
public string name { get; set; }
|
public string name { get; set; }
|
||||||
public int device_amount { get; set; }
|
public int device_amount { get; set; }
|
||||||
public List<GroupFloor> groupFloors { get; set; }
|
public List<GroupFloor> groupFloors { get; set; }
|
||||||
@ -68,13 +68,13 @@ namespace FrontendWebApi.Models
|
|||||||
{
|
{
|
||||||
public string floor_guid { get; set; }
|
public string floor_guid { get; set; }
|
||||||
public string floorname { get; set; }
|
public string floorname { get; set; }
|
||||||
public string building_guid { get; set; }
|
public string building_tag { get; set; }
|
||||||
public string buildingname { get; set; }
|
public string buildingname { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class BuildingToF
|
public class BuildingToF
|
||||||
{
|
{
|
||||||
public string building_guid { get; set; }
|
public string building_tag { get; set; }
|
||||||
public string building_name { get; set; }
|
public string building_name { get; set; }
|
||||||
public List<FloorForB> floors { get; set; }
|
public List<FloorForB> floors { get; set; }
|
||||||
}
|
}
|
||||||
@ -89,7 +89,7 @@ namespace FrontendWebApi.Models
|
|||||||
public string device_guid { get; set; }
|
public string device_guid { get; set; }
|
||||||
public string device_number { get; set; }
|
public string device_number { get; set; }
|
||||||
public string device_name { get; set; }
|
public string device_name { get; set; }
|
||||||
public string building_guid { get; set; }
|
public string building_tag { get; set; }
|
||||||
public string building_name { get; set; }
|
public string building_name { get; set; }
|
||||||
public string ip_address { get; set; }
|
public string ip_address { get; set; }
|
||||||
public string layer2 { get; set; }
|
public string layer2 { get; set; }
|
||||||
|
@ -264,6 +264,7 @@ namespace FrontendWebApi.Models
|
|||||||
public class HistoryItem
|
public class HistoryItem
|
||||||
{
|
{
|
||||||
public string Device_number_point { get; set; }
|
public string Device_number_point { get; set; }
|
||||||
|
public string Device_number { get; set; }
|
||||||
public string Unit { get; set; }
|
public string Unit { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ namespace FrontendWebApi.Models
|
|||||||
{
|
{
|
||||||
public string rescue_device_guid { get; set; }
|
public string rescue_device_guid { get; set; }
|
||||||
public string rescue_device_id { get; set; }
|
public string rescue_device_id { get; set; }
|
||||||
public string building_guid { get; set; }
|
public string building_tag { get; set; }
|
||||||
public string floor_guid { get; set; }
|
public string floor_guid { get; set; }
|
||||||
public string floor_name { get; set; }
|
public string floor_name { get; set; }
|
||||||
public string location { get; set; }
|
public string location { get; set; }
|
||||||
|
@ -106,7 +106,7 @@
|
|||||||
$(row).attr('guid', data.emergency_guid);
|
$(row).attr('guid', data.emergency_guid);
|
||||||
},
|
},
|
||||||
"ajax": {
|
"ajax": {
|
||||||
"url": "/EmergencyContact/EmergencyContactTable",
|
"url": "/api/EmergencyContact/EmergencyContactTable",
|
||||||
"type": "POST",
|
"type": "POST",
|
||||||
"data": function (d) {
|
"data": function (d) {
|
||||||
d.selectgroupidlist = selectgroupidlist
|
d.selectgroupidlist = selectgroupidlist
|
||||||
@ -116,7 +116,7 @@
|
|||||||
toast_error(rel.msg);
|
toast_error(rel.msg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
data = rel.data.data;
|
data = rel.data;
|
||||||
if (data == null || data.length == 0) {
|
if (data == null || data.length == 0) {
|
||||||
|
|
||||||
this.data = [];
|
this.data = [];
|
||||||
|
@ -224,7 +224,7 @@
|
|||||||
</button>*@
|
</button>*@
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<form id="emergency-item-form">
|
<form id="emergency-item-form" onsubmit="PassVerify(true)">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="form-group col-6">
|
<div class="form-group col-6">
|
||||||
<label class="form-label" for="emergency_verify_modal"><span class="text-danger">*</span>指揮官密碼</label>
|
<label class="form-label" for="emergency_verify_modal"><span class="text-danger">*</span>指揮官密碼</label>
|
||||||
@ -282,20 +282,23 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
<textarea class="form-control mt-3 mb-2" rows="5"></textarea>
|
<textarea class="form-control mt-3 mb-2" rows="5" id="sms_messagebox"></textarea>
|
||||||
<span>發訊人:</span>
|
<span>發訊人:</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row justify-content-between">
|
<div class="row justify-content-between">
|
||||||
<div class="col-auto">
|
<div class="col-auto">
|
||||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
|
<button type="button" class="btn btn-secondary" data-dismiss="modal" onclick="PassVerify(false)">取消</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-auto row">
|
<div class="col-auto row">
|
||||||
<div class="col-auto">
|
<div class="col-auto">
|
||||||
<input class="form-control" type="text" placeholder="請輸入指揮官密碼" />
|
<input class="form-control" type="password" id="sendSms_verify_input" placeholder="請輸入指揮官密碼" />
|
||||||
</div>
|
</div>
|
||||||
<div class="col-auto">
|
<div class="col-auto">
|
||||||
<button type="button" class="btn btn-primary" onclick="SaveSubSetting()">儲存</button>
|
|
||||||
|
<button type="button" class="btn btn-primary" onclick="PassVerify(true)">
|
||||||
|
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true" id="smsSaveBtnLoading" style="display:none"></span>
|
||||||
|
儲存</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -337,7 +340,7 @@
|
|||||||
var SelectedFilter =
|
var SelectedFilter =
|
||||||
{
|
{
|
||||||
disasters: [],
|
disasters: [],
|
||||||
building_guid: '',
|
building_tag: '',
|
||||||
floor_guids: [],
|
floor_guids: [],
|
||||||
layer2: [],
|
layer2: [],
|
||||||
layer3: []
|
layer3: []
|
||||||
@ -346,8 +349,11 @@
|
|||||||
var Verifybool = false; //-驗證成功
|
var Verifybool = false; //-驗證成功
|
||||||
var CloseVerify = false;
|
var CloseVerify = false;
|
||||||
var ToVerifyType = 0;
|
var ToVerifyType = 0;
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
|
$("#emergency-item-form").submit((e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
})
|
||||||
|
|
||||||
//#region 定時取得報警設備(3s)
|
//#region 定時取得報警設備(3s)
|
||||||
interval_id = setInterval(function () {
|
interval_id = setInterval(function () {
|
||||||
@ -393,7 +399,7 @@
|
|||||||
|
|
||||||
$("#building").find(".building_device_amount").html(0);
|
$("#building").find(".building_device_amount").html(0);
|
||||||
rel.data.buildingAlarmDeviceAmount.forEach(function (item) {
|
rel.data.buildingAlarmDeviceAmount.forEach(function (item) {
|
||||||
$(`#${item.building_guid}_device_amount`).html(item.device_amount);
|
$(`#${item.building_tag}_device_amount`).html(item.device_amount);
|
||||||
});
|
});
|
||||||
ResetDeviceTable();
|
ResetDeviceTable();
|
||||||
}
|
}
|
||||||
@ -450,7 +456,7 @@
|
|||||||
SmsMemberTable = $("#smsMemberTable").DataTable({
|
SmsMemberTable = $("#smsMemberTable").DataTable({
|
||||||
"columns": [
|
"columns": [
|
||||||
{
|
{
|
||||||
"data": "full_name"
|
"data": "name"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"data": "departmentName"
|
"data": "departmentName"
|
||||||
@ -562,13 +568,13 @@
|
|||||||
"data": "device_number",
|
"data": "device_number",
|
||||||
"render": function (data, type, row, meta) {
|
"render": function (data, type, row, meta) {
|
||||||
@*var html = `
|
@*var html = `
|
||||||
<a href="javascript:void(0)" onclick="ChangeFloormap('${row.building_guid}', '${row.floorguid}', '${data}', '${row.layer3}')">
|
<a href="javascript:void(0)" onclick="ChangeFloormap('${row.building_tag}', '${row.floorguid}', '${data}', '${row.layer3}')">
|
||||||
${data}
|
${data}
|
||||||
</a>
|
</a>
|
||||||
`;*@
|
`;*@
|
||||||
|
|
||||||
var html = `
|
var html = `
|
||||||
<a href="http://${row.ip_address}/file/BajascriptTest/_FloorMap.html?building_guid=${row.building_guid}&floor_guid=${row.floorguid}&layer3=${row.layer3}&device_number=${data}&show_cctv=1&jwt=${localStorage.getItem('JWT-Authorization')}" target="_blank">
|
<a href="http://${row.ip_address}/file/BajascriptTest/_FloorMap.html?building_tag=${row.building_tag}&floor_guid=${row.floorguid}&layer3=${row.layer3}&device_number=${data}&show_cctv=1&jwt=${localStorage.getItem('JWT-Authorization')}" target="_blank">
|
||||||
${data}
|
${data}
|
||||||
</a>
|
</a>
|
||||||
`;
|
`;
|
||||||
@ -620,7 +626,7 @@
|
|||||||
"type": "POST",
|
"type": "POST",
|
||||||
"data": function (d) {
|
"data": function (d) {
|
||||||
d.select_disasters = SelectedFilter.disasters;
|
d.select_disasters = SelectedFilter.disasters;
|
||||||
d.selectbuilding = SelectedFilter.building_guid;
|
d.selectbuilding = SelectedFilter.building_tag;
|
||||||
d.select_Floors = SelectedFilter.floor_guids;
|
d.select_Floors = SelectedFilter.floor_guids;
|
||||||
d.select_Layer3 = SelectedFilter.layer3;
|
d.select_Layer3 = SelectedFilter.layer3;
|
||||||
},
|
},
|
||||||
@ -656,7 +662,7 @@
|
|||||||
device_number: temp_device.device_number,
|
device_number: temp_device.device_number,
|
||||||
device_name: temp_device.device_name,
|
device_name: temp_device.device_name,
|
||||||
building_name: temp_device.building_name,
|
building_name: temp_device.building_name,
|
||||||
building_guid: temp_device.building_guid,
|
building_tag: temp_device.building_tag,
|
||||||
ip_address: temp_device.ip_address,
|
ip_address: temp_device.ip_address,
|
||||||
disaster: temp_device.disaster,
|
disaster: temp_device.disaster,
|
||||||
disaster_name: temp_device.disaster_name,
|
disaster_name: temp_device.disaster_name,
|
||||||
@ -669,10 +675,10 @@
|
|||||||
alarm_timestamp: alarm_device.alarm_timestamp,
|
alarm_timestamp: alarm_device.alarm_timestamp,
|
||||||
}
|
}
|
||||||
|
|
||||||
var temp_building_index = backfill_building_alarm_device_amount.findIndex(x => x.building_guid == temp_device.building_guid);
|
var temp_building_index = backfill_building_alarm_device_amount.findIndex(x => x.building_tag == temp_device.building_tag);
|
||||||
if (temp_building_index < 0) {
|
if (temp_building_index < 0) {
|
||||||
var building_obj = {
|
var building_obj = {
|
||||||
building_guid: temp_device.building_guid,
|
building_tag: temp_device.building_tag,
|
||||||
device_amount: 1
|
device_amount: 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -681,10 +687,10 @@
|
|||||||
backfill_building_alarm_device_amount[temp_building_index].device_amount += 1;
|
backfill_building_alarm_device_amount[temp_building_index].device_amount += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
var temp_layer2_index = backfill_layer2_alarm_device_amount.findIndex(x => x.value == temp_device.layer2 && x.building_guid == temp_device.building_guid)
|
var temp_layer2_index = backfill_layer2_alarm_device_amount.findIndex(x => x.value == temp_device.layer2 && x.building_tag == temp_device.building_tag)
|
||||||
if (temp_layer2_index < 0) {
|
if (temp_layer2_index < 0) {
|
||||||
var layer2_obj = {
|
var layer2_obj = {
|
||||||
building_guid: temp_device.building_guid,
|
building_tag: temp_device.building_tag,
|
||||||
value: temp_device.layer2,
|
value: temp_device.layer2,
|
||||||
device_amount: 1
|
device_amount: 1
|
||||||
}
|
}
|
||||||
@ -694,10 +700,10 @@
|
|||||||
backfill_layer2_alarm_device_amount[temp_layer2_index].device_amount += 1;
|
backfill_layer2_alarm_device_amount[temp_layer2_index].device_amount += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
var temp_layer3_index = backfill_layer3_alarm_device_amount.findIndex(x => x.layer3 == temp_device.layer3 && x.layer2 == temp_device.layer2 && x.building_guid == temp_device.building_guid)
|
var temp_layer3_index = backfill_layer3_alarm_device_amount.findIndex(x => x.layer3 == temp_device.layer3 && x.layer2 == temp_device.layer2 && x.building_tag == temp_device.building_tag)
|
||||||
if (temp_layer3_index < 0) {
|
if (temp_layer3_index < 0) {
|
||||||
var layer3_obj = {
|
var layer3_obj = {
|
||||||
building_guid: temp_device.building_guid,
|
building_tag: temp_device.building_tag,
|
||||||
layer2: temp_device.layer2,
|
layer2: temp_device.layer2,
|
||||||
layer3: temp_device.layer3,
|
layer3: temp_device.layer3,
|
||||||
device_amount: 1
|
device_amount: 1
|
||||||
@ -764,10 +770,10 @@
|
|||||||
device_amount: layer3.device_amount
|
device_amount: layer3.device_amount
|
||||||
}
|
}
|
||||||
|
|
||||||
var temp_building_index = backfill_building_device_amount.findIndex(x => x.building_guid == building.guid);
|
var temp_building_index = backfill_building_device_amount.findIndex(x => x.building_tag == building.tag);
|
||||||
if (temp_building_index < 0) {
|
if (temp_building_index < 0) {
|
||||||
var building_obj = {
|
var building_obj = {
|
||||||
building_guid: building.guid,
|
building_tag: building.tag,
|
||||||
device_amount: new_layer3.device_amount
|
device_amount: new_layer3.device_amount
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -776,10 +782,10 @@
|
|||||||
backfill_building_device_amount[temp_building_index].device_amount += new_layer3.device_amount;
|
backfill_building_device_amount[temp_building_index].device_amount += new_layer3.device_amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
var temp_layer2_index = backfill_layer2_device_amount.findIndex(x => x.value == layer2.value && x.building_guid == building.guid)
|
var temp_layer2_index = backfill_layer2_device_amount.findIndex(x => x.value == layer2.value && x.building_tag == building.tag)
|
||||||
if (temp_layer2_index < 0) {
|
if (temp_layer2_index < 0) {
|
||||||
var layer2_obj = {
|
var layer2_obj = {
|
||||||
building_guid: building.guid,
|
building_tag: building.tag,
|
||||||
value: layer2.value,
|
value: layer2.value,
|
||||||
device_amount: new_layer3.device_amount
|
device_amount: new_layer3.device_amount
|
||||||
}
|
}
|
||||||
@ -789,10 +795,10 @@
|
|||||||
backfill_layer2_device_amount[temp_layer2_index].device_amount += new_layer3.device_amount;
|
backfill_layer2_device_amount[temp_layer2_index].device_amount += new_layer3.device_amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
var temp_layer3_index = backfill_layer3_device_amount.findIndex(x => x.layer3 == layer3.value && x.layer2 == layer2.value && x.building_guid == building.guid)
|
var temp_layer3_index = backfill_layer3_device_amount.findIndex(x => x.layer3 == layer3.value && x.layer2 == layer2.value && x.building_tag == building.tag)
|
||||||
if (temp_layer3_index < 0) {
|
if (temp_layer3_index < 0) {
|
||||||
var layer3_obj = {
|
var layer3_obj = {
|
||||||
building_guid: building.guid,
|
building_tag: building.tag,
|
||||||
layer2: layer2.value,
|
layer2: layer2.value,
|
||||||
layer3: layer3.value,
|
layer3: layer3.value,
|
||||||
device_amount: new_layer3.device_amount
|
device_amount: new_layer3.device_amount
|
||||||
@ -866,6 +872,7 @@
|
|||||||
|
|
||||||
is_need_reload = true;
|
is_need_reload = true;
|
||||||
ChangeFilterBuilding();
|
ChangeFilterBuilding();
|
||||||
|
UpdateDeviceAmount();
|
||||||
@*console.log("SelectedFilter", SelectedFilter);*@
|
@*console.log("SelectedFilter", SelectedFilter);*@
|
||||||
}
|
}
|
||||||
//#endregion
|
//#endregion
|
||||||
@ -886,6 +893,7 @@
|
|||||||
|
|
||||||
is_need_reload = true;
|
is_need_reload = true;
|
||||||
ChangeFilterBuilding();
|
ChangeFilterBuilding();
|
||||||
|
UpdateDeviceAmount();
|
||||||
@*console.log("SelectedFilter", SelectedFilter);*@
|
@*console.log("SelectedFilter", SelectedFilter);*@
|
||||||
}
|
}
|
||||||
//#endregion
|
//#endregion
|
||||||
@ -897,7 +905,7 @@
|
|||||||
all_device_group.forEach(function (disaster, disaster_index) {
|
all_device_group.forEach(function (disaster, disaster_index) {
|
||||||
if (SelectedFilter.disasters.findIndex(x => x == disaster.value) > -1) { //表示已選擇該防災類型
|
if (SelectedFilter.disasters.findIndex(x => x == disaster.value) > -1) { //表示已選擇該防災類型
|
||||||
disaster.groupBuildings.forEach(function (building, building_index) {
|
disaster.groupBuildings.forEach(function (building, building_index) {
|
||||||
if (temp_all_building.findIndex(x => x.guid == building.guid) < 0) { //表示未加入,需加入
|
if (temp_all_building.findIndex(x => x.tag == building.tag) < 0) { //表示未加入,需加入
|
||||||
temp_all_building.push(building);
|
temp_all_building.push(building);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -909,16 +917,16 @@
|
|||||||
var html = "";
|
var html = "";
|
||||||
temp_all_building.forEach(function (building, building_index) {
|
temp_all_building.forEach(function (building, building_index) {
|
||||||
|
|
||||||
var building_device_amount = backfill_building_device_amount.filter(x => x.building_guid == building.guid)[0];
|
var building_device_amount = backfill_building_device_amount.filter(x => x.building_tag == building.tag)[0];
|
||||||
|
|
||||||
@*html += `<div class="btn-group ml-2" onclick="SelectBuilding('${building.guid}',this)">
|
@*html += `<div class="btn-group ml-2" onclick="SelectBuilding('${building.tag}',this)">
|
||||||
<button type="button" class="btn btn-secondary">${building.name}</button>
|
<button type="button" class="btn btn-secondary">${building.name}</button>
|
||||||
<button type="button" class="btn btn-secondary building_device_amount" id="${building.guid}_device_amount">${building_device_amount.device_amount}</button>
|
<button type="button" class="btn btn-secondary building_device_amount" id="${building.tag}_device_amount">${building_device_amount.device_amount}</button>
|
||||||
</div>`;*@
|
</div>`;*@
|
||||||
|
|
||||||
html += `<div class="btn-group ml-2" onclick="SelectBuilding('${building.guid}',this)">
|
html += `<div class="btn-group ml-2" onclick="SelectBuilding('${building.tag}',this)">
|
||||||
<button type="button" class="btn btn-secondary">${building.name}</button>
|
<button type="button" class="btn btn-secondary">${building.name}</button>
|
||||||
<button type="button" class="btn btn-secondary building_device_amount" id="${building.guid}_device_amount">0</button>
|
<button type="button" class="btn btn-secondary building_device_amount" id="${building.tag}_device_amount">0</button>
|
||||||
</div>`;
|
</div>`;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -929,7 +937,7 @@
|
|||||||
else {
|
else {
|
||||||
var html = "";
|
var html = "";
|
||||||
temp_all_building.forEach(function (building, building_index) {
|
temp_all_building.forEach(function (building, building_index) {
|
||||||
html += '<button type="button" class="btn btn-secondary ml-2" onclick="SelectBuilding(\'' + building.guid + '\',this)">' + building.name + '</button>';
|
html += '<button type="button" class="btn btn-secondary ml-2" onclick="SelectBuilding(\'' + building.tag + '\',this)">' + building.name + '</button>';
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#building').append(html);
|
$('#building').append(html);
|
||||||
@ -941,10 +949,10 @@
|
|||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
//#region 選擇棟別
|
//#region 選擇棟別
|
||||||
function SelectBuilding(building_guid, e) {
|
function SelectBuilding(building_tag, e) {
|
||||||
$('#building').find('button').removeClass('btn-success').addClass('btn-secondary')
|
$('#building').find('button').removeClass('btn-success').addClass('btn-secondary')
|
||||||
|
|
||||||
SelectedFilter.building_guid = building_guid;
|
SelectedFilter.building_tag = building_tag;
|
||||||
if (show_mode == 'alarm') {
|
if (show_mode == 'alarm') {
|
||||||
$(e).find('button').addClass('btn-success');
|
$(e).find('button').addClass('btn-success');
|
||||||
} else {
|
} else {
|
||||||
@ -953,6 +961,7 @@
|
|||||||
|
|
||||||
is_need_reload = true;
|
is_need_reload = true;
|
||||||
ChangeFilterFloor();
|
ChangeFilterFloor();
|
||||||
|
UpdateDeviceAmount();
|
||||||
@*console.log("SelectedFilter", SelectedFilter);*@
|
@*console.log("SelectedFilter", SelectedFilter);*@
|
||||||
}
|
}
|
||||||
//#endregion
|
//#endregion
|
||||||
@ -963,9 +972,9 @@
|
|||||||
all_device_group.forEach(function (disaster, disaster_index) {
|
all_device_group.forEach(function (disaster, disaster_index) {
|
||||||
if (SelectedFilter.disasters.findIndex(x => x == disaster.value) > -1) { //抓取已選擇的防災類型的棟別內容
|
if (SelectedFilter.disasters.findIndex(x => x == disaster.value) > -1) { //抓取已選擇的防災類型的棟別內容
|
||||||
disaster.groupBuildings.forEach(function (building, building_index) {
|
disaster.groupBuildings.forEach(function (building, building_index) {
|
||||||
if (building.guid == SelectedFilter.building_guid) { //抓取選擇棟別的底下樓層
|
if (building.tag == SelectedFilter.building_tag) { //抓取選擇棟別的底下樓層
|
||||||
building.groupFloors.forEach(function (floor, floor_index) {
|
building.groupFloors.forEach(function (floor, floor_index) {
|
||||||
if (temp_all_floor.findIndex(x => x.guid == floor.guid) < 0) { //表示未加入,需加入
|
if (temp_all_floor.findIndex(x => x.name == floor.name) < 0) { //表示未加入,需加入
|
||||||
temp_all_floor.push(floor);
|
temp_all_floor.push(floor);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -978,7 +987,7 @@
|
|||||||
$("#floors").append(`<button type="button" class="btn btn-secondary ml-2 mb-2" onclick="AllFloor()">全選</button>`);
|
$("#floors").append(`<button type="button" class="btn btn-secondary ml-2 mb-2" onclick="AllFloor()">全選</button>`);
|
||||||
var html = "";
|
var html = "";
|
||||||
temp_all_floor.forEach(function (floor, floor_index) {
|
temp_all_floor.forEach(function (floor, floor_index) {
|
||||||
html += '<button type="button" class="btn btn-outline-success ml-2 mb-2" onclick="SelectFloor(\'' + floor.guid + '\',this)">' + floor.name + '</button>';
|
html += '<button type="button" class="btn btn-outline-success ml-2 mb-2" onclick="SelectFloor(\'' + floor.name + '\',this)">' + floor.name + '</button>';
|
||||||
});
|
});
|
||||||
$('#floors').append(html);
|
$('#floors').append(html);
|
||||||
|
|
||||||
@ -998,32 +1007,34 @@
|
|||||||
$('#floors').find('.btn-outline-success').removeClass('btn-outline-success').addClass('btn-success');
|
$('#floors').find('.btn-outline-success').removeClass('btn-outline-success').addClass('btn-success');
|
||||||
SelectedFilter.floor_guids = [];
|
SelectedFilter.floor_guids = [];
|
||||||
temp_all_floor.forEach(function (floor, floor_index) {
|
temp_all_floor.forEach(function (floor, floor_index) {
|
||||||
SelectedFilter.floor_guids.push(floor.guid);
|
SelectedFilter.floor_guids.push(floor.name);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
is_need_reload = true;
|
is_need_reload = true;
|
||||||
ChangeFilterLayer2();
|
ChangeFilterLayer2();
|
||||||
|
UpdateDeviceAmount();
|
||||||
@*console.log("SelectedFilter", SelectedFilter);*@
|
@*console.log("SelectedFilter", SelectedFilter);*@
|
||||||
}
|
}
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
//#region 選擇樓層
|
//#region 選擇樓層
|
||||||
function SelectFloor(floor_guid, e) {
|
function SelectFloor(floor_tag, e) {
|
||||||
select_all_floor = false;
|
select_all_floor = false;
|
||||||
|
|
||||||
var floor_index = SelectedFilter.floor_guids.findIndex(x => x == floor_guid);
|
var floor_index = SelectedFilter.floor_guids.findIndex(x => x == floor_tag);
|
||||||
if (floor_index > -1) { //已選擇 -> 未選擇
|
if (floor_index > -1) { //已選擇 -> 未選擇
|
||||||
SelectedFilter.floor_guids.splice(floor_index, 1);
|
SelectedFilter.floor_guids.splice(floor_index, 1);
|
||||||
$(e).removeClass('btn-success').addClass('btn-outline-success');
|
$(e).removeClass('btn-success').addClass('btn-outline-success');
|
||||||
}
|
}
|
||||||
else { //未選擇 -> 已選擇
|
else { //未選擇 -> 已選擇
|
||||||
SelectedFilter.floor_guids.push(floor_guid);
|
SelectedFilter.floor_guids.push(floor_tag);
|
||||||
$(e).removeClass('btn-outline-success').addClass('btn-success');
|
$(e).removeClass('btn-outline-success').addClass('btn-success');
|
||||||
}
|
}
|
||||||
|
|
||||||
is_need_reload = true;
|
is_need_reload = true;
|
||||||
ChangeFilterLayer2();
|
ChangeFilterLayer2();
|
||||||
|
UpdateDeviceAmount();
|
||||||
@*console.log("SelectedFilter", SelectedFilter);*@
|
@*console.log("SelectedFilter", SelectedFilter);*@
|
||||||
}
|
}
|
||||||
//#endregion
|
//#endregion
|
||||||
@ -1034,9 +1045,9 @@
|
|||||||
all_device_group.forEach(function (disaster, disaster_index) {
|
all_device_group.forEach(function (disaster, disaster_index) {
|
||||||
if (SelectedFilter.disasters.findIndex(x => x == disaster.value) > -1) { //抓取選擇防災類型的底下棟別
|
if (SelectedFilter.disasters.findIndex(x => x == disaster.value) > -1) { //抓取選擇防災類型的底下棟別
|
||||||
disaster.groupBuildings.forEach(function (building, building_index) {
|
disaster.groupBuildings.forEach(function (building, building_index) {
|
||||||
if (building.guid == SelectedFilter.building_guid) { //抓取選擇棟別的底下樓層
|
if (building.tag == SelectedFilter.building_tag) { //抓取選擇棟別的底下樓層
|
||||||
building.groupFloors.forEach(function (floor, floor_index) {
|
building.groupFloors.forEach(function (floor, floor_index) {
|
||||||
if (SelectedFilter.floor_guids.findIndex(x => x == floor.guid) > -1) { //抓取選擇樓層的底下大類
|
if (SelectedFilter.floor_guids.findIndex(x => x == floor.name) > -1) { //抓取選擇樓層的底下大類
|
||||||
floor.groupLayer2s.forEach(function (layer2, layer2_index) {
|
floor.groupLayer2s.forEach(function (layer2, layer2_index) {
|
||||||
if (temp_all_layer2.findIndex(x => x.value == layer2.value) < 0) {
|
if (temp_all_layer2.findIndex(x => x.value == layer2.value) < 0) {
|
||||||
temp_all_layer2.push(layer2);
|
temp_all_layer2.push(layer2);
|
||||||
@ -1056,18 +1067,18 @@
|
|||||||
var html = "";
|
var html = "";
|
||||||
temp_all_layer2.forEach(function (layer2, layer2_index) {
|
temp_all_layer2.forEach(function (layer2, layer2_index) {
|
||||||
|
|
||||||
var layer2_device_amount = backfill_layer2_device_amount.filter(x => x.value == layer2.value && x.building_guid == SelectedFilter.building_guid)[0];
|
var layer2_device_amount = backfill_layer2_device_amount.filter(x => x.value == layer2.value && x.building_tag == SelectedFilter.building_tag)[0];
|
||||||
|
|
||||||
@*html += `
|
@*html += `
|
||||||
<div class="btn-group ml-2 mb-2" onclick="SelectLayer2('${layer2.value}',this)">
|
<div class="btn-group ml-2 mb-2" onclick="SelectLayer2('${layer2.value}',this)">
|
||||||
<button type="button" class="btn btn-outline-success">${layer2.name}</button>
|
<button type="button" class="btn btn-outline-success">${layer2.name}</button>
|
||||||
<button type="button" class="btn btn-outline-success device_amount" id="${layer2_device_amount.building_guid}_${layer2_device_amount.value}_device_amount">${layer2_device_amount.device_amount}</button>
|
<button type="button" class="btn btn-outline-success device_amount" id="${layer2_device_amount.building_tag}_${layer2_device_amount.value}_device_amount">${layer2_device_amount.device_amount}</button>
|
||||||
</div>`;*@
|
</div>`;*@
|
||||||
|
|
||||||
html += `
|
html += `
|
||||||
<div class="btn-group ml-2 mb-2" onclick="SelectLayer2('${layer2.value}',this)">
|
<div class="btn-group ml-2 mb-2" onclick="SelectLayer2('${layer2.value}',this)">
|
||||||
<button type="button" class="btn btn-outline-success">${layer2.name}</button>
|
<button type="button" class="btn btn-outline-success">${layer2.name}</button>
|
||||||
<button type="button" class="btn btn-outline-success device_amount" id="${layer2_device_amount.building_guid}_${layer2_device_amount.value}_device_amount">0</button>
|
<button type="button" class="btn btn-outline-success device_amount" id="${layer2_device_amount.building_tag}_${layer2_device_amount.value}_device_amount">0</button>
|
||||||
</div>`;
|
</div>`;
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -1095,6 +1106,7 @@
|
|||||||
|
|
||||||
is_need_reload = true;
|
is_need_reload = true;
|
||||||
ChangeFilterLayer3();
|
ChangeFilterLayer3();
|
||||||
|
UpdateDeviceAmount();
|
||||||
@*console.log("SelectedFilter", SelectedFilter);*@
|
@*console.log("SelectedFilter", SelectedFilter);*@
|
||||||
}
|
}
|
||||||
//#endregion
|
//#endregion
|
||||||
@ -1115,6 +1127,7 @@
|
|||||||
|
|
||||||
is_need_reload = true;
|
is_need_reload = true;
|
||||||
ChangeFilterLayer3();
|
ChangeFilterLayer3();
|
||||||
|
UpdateDeviceAmount();
|
||||||
@*console.log("SelectedFilter", SelectedFilter);*@
|
@*console.log("SelectedFilter", SelectedFilter);*@
|
||||||
}
|
}
|
||||||
//#endregion
|
//#endregion
|
||||||
@ -1125,9 +1138,9 @@
|
|||||||
all_device_group.forEach(function (disaster, disaster_index) {
|
all_device_group.forEach(function (disaster, disaster_index) {
|
||||||
if (SelectedFilter.disasters.findIndex(x => x == disaster.value) > -1) { //抓取選擇防災類型的底下棟別
|
if (SelectedFilter.disasters.findIndex(x => x == disaster.value) > -1) { //抓取選擇防災類型的底下棟別
|
||||||
disaster.groupBuildings.forEach(function (building, building_index) {
|
disaster.groupBuildings.forEach(function (building, building_index) {
|
||||||
if (building.guid == SelectedFilter.building_guid) { //抓取選擇棟別的底下樓層
|
if (building.tag == SelectedFilter.building_tag) { //抓取選擇棟別的底下樓層
|
||||||
building.groupFloors.forEach(function (floor, floor_index) {
|
building.groupFloors.forEach(function (floor, floor_index) {
|
||||||
if (SelectedFilter.floor_guids.findIndex(x => x == floor.guid) > -1) { //抓取選擇樓層的底下大類
|
if (SelectedFilter.floor_guids.findIndex(x => x == floor.name) > -1) { //抓取選擇樓層的底下大類
|
||||||
floor.groupLayer2s.forEach(function (layer2, layer2_index) {
|
floor.groupLayer2s.forEach(function (layer2, layer2_index) {
|
||||||
if (SelectedFilter.layer2.findIndex(x => x == layer2.value) > -1) { //抓取選擇大類的底下小類
|
if (SelectedFilter.layer2.findIndex(x => x == layer2.value) > -1) { //抓取選擇大類的底下小類
|
||||||
layer2.groupLayer3s.forEach(function (layer3, layer3_index) {
|
layer2.groupLayer3s.forEach(function (layer3, layer3_index) {
|
||||||
@ -1161,18 +1174,18 @@
|
|||||||
var html = "";
|
var html = "";
|
||||||
temp_all_layer3.forEach(function (layer3, layer3_index) {
|
temp_all_layer3.forEach(function (layer3, layer3_index) {
|
||||||
|
|
||||||
var layer3_device_amount = backfill_layer3_device_amount.filter(x => x.layer3 == layer3.value && x.building_guid == SelectedFilter.building_guid)[0];
|
var layer3_device_amount = backfill_layer3_device_amount.filter(x => x.layer3 == layer3.value && x.building_tag == SelectedFilter.building_tag)[0];
|
||||||
|
|
||||||
@*html += `
|
@*html += `
|
||||||
<div class="btn-group ml-2 mb-2" onclick="SelectLayer3('${layer3.value}',this)">
|
<div class="btn-group ml-2 mb-2" onclick="SelectLayer3('${layer3.value}',this)">
|
||||||
<button type="button" class="btn btn-outline-success">${layer3.name}</button>
|
<button type="button" class="btn btn-outline-success">${layer3.name}</button>
|
||||||
<button type="button" class="btn btn-outline-success device_amount" id="${layer3_device_amount.building_guid}_${layer3_device_amount.layer3}_device_amount">${layer3_device_amount.device_amount}</button>
|
<button type="button" class="btn btn-outline-success device_amount" id="${layer3_device_amount.building_tag}_${layer3_device_amount.layer3}_device_amount">${layer3_device_amount.device_amount}</button>
|
||||||
</div>`;*@
|
</div>`;*@
|
||||||
|
|
||||||
html += `
|
html += `
|
||||||
<div class="btn-group ml-2 mb-2" onclick="SelectLayer3('${layer3.value}',this)">
|
<div class="btn-group ml-2 mb-2" onclick="SelectLayer3('${layer3.value}',this)">
|
||||||
<button type="button" class="btn btn-outline-success">${layer3.name}</button>
|
<button type="button" class="btn btn-outline-success">${layer3.name}</button>
|
||||||
<button type="button" class="btn btn-outline-success device_amount" id="${layer3_device_amount.building_guid}_${layer3_device_amount.layer3}_device_amount">0</button>
|
<button type="button" class="btn btn-outline-success device_amount" id="${layer3_device_amount.building_tag}_${layer3_device_amount.layer3}_device_amount">0</button>
|
||||||
</div>`;
|
</div>`;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1200,6 +1213,7 @@
|
|||||||
|
|
||||||
is_need_reload = true;
|
is_need_reload = true;
|
||||||
ResetDeviceTable();
|
ResetDeviceTable();
|
||||||
|
UpdateDeviceAmount();
|
||||||
}
|
}
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
@ -1219,6 +1233,7 @@
|
|||||||
|
|
||||||
is_need_reload = true;
|
is_need_reload = true;
|
||||||
ResetDeviceTable();
|
ResetDeviceTable();
|
||||||
|
UpdateDeviceAmount();
|
||||||
}
|
}
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
@ -1226,20 +1241,20 @@
|
|||||||
function ResetDeviceTable() {
|
function ResetDeviceTable() {
|
||||||
|
|
||||||
if ((SelectedFilter.disasters == null || SelectedFilter.disasters.length <= 0)
|
if ((SelectedFilter.disasters == null || SelectedFilter.disasters.length <= 0)
|
||||||
|| (SelectedFilter.building_guid == null || SelectedFilter.building_guid == "")
|
|| (SelectedFilter.building_tag == null || SelectedFilter.building_tag == "")
|
||||||
|| (SelectedFilter.floor_guids == null || SelectedFilter.floor_guids.length <= 0)
|
|| (SelectedFilter.floor_guids == null || SelectedFilter.floor_guids.length <= 0)
|
||||||
|| (SelectedFilter.layer3 == null || SelectedFilter.layer3.length <= 0)
|
|| (SelectedFilter.layer3 == null || SelectedFilter.layer3.length <= 0)
|
||||||
) {
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (changeBuilding != "" && changeBuilding != SelectedFilter.building_guid) {
|
if (changeBuilding != "" && changeBuilding != SelectedFilter.building_tag) {
|
||||||
alarmDeviceTable.clear().draw();
|
alarmDeviceTable.clear().draw();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
alarmDeviceTable.ajax.reload(null, false);
|
alarmDeviceTable.ajax.reload(null, false);
|
||||||
}
|
}
|
||||||
changeBuilding = SelectedFilter.building_guid;
|
changeBuilding = SelectedFilter.building_tag;
|
||||||
}
|
}
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
@ -1250,39 +1265,39 @@
|
|||||||
|
|
||||||
if (show_mode == 'alarm') {
|
if (show_mode == 'alarm') {
|
||||||
backfill_building_alarm_device_amount.forEach(function (building, index) {
|
backfill_building_alarm_device_amount.forEach(function (building, index) {
|
||||||
$(`#${building.building_guid}_device_amount`).html(building.device_amount);
|
$(`#${building.building_tag}_device_amount`).html(building.device_amount);
|
||||||
});
|
});
|
||||||
|
|
||||||
backfill_layer2_alarm_device_amount.forEach(function (layer2, index) {
|
backfill_layer2_alarm_device_amount.forEach(function (layer2, index) {
|
||||||
$(`#${layer2.building_guid}_${layer2.value}_device_amount`).html(layer2.device_amount);
|
$(`#${layer2.building_tag}_${layer2.value}_device_amount`).html(layer2.device_amount);
|
||||||
});
|
});
|
||||||
|
|
||||||
backfill_layer3_alarm_device_amount.forEach(function (layer3, index) {
|
backfill_layer3_alarm_device_amount.forEach(function (layer3, index) {
|
||||||
$(`#${layer3.building_guid}_${layer3.layer3}_device_amount`).html(layer3.device_amount);
|
$(`#${layer3.building_tag}_${layer3.layer3}_device_amount`).html(layer3.device_amount);
|
||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
backfill_building_device_amount.forEach(function (building, index) {
|
backfill_building_device_amount.forEach(function (building, index) {
|
||||||
$(`#${building.building_guid}_device_amount`).html(building.device_amount);
|
$(`#${building.building_tag}_device_amount`).html(building.device_amount);
|
||||||
});
|
});
|
||||||
|
|
||||||
backfill_layer2_device_amount.forEach(function (layer2, index) {
|
backfill_layer2_device_amount.forEach(function (layer2, index) {
|
||||||
$(`#${layer2.building_guid}_${layer2.value}_device_amount`).html(layer2.device_amount);
|
$(`#${layer2.building_tag}_${layer2.value}_device_amount`).html(layer2.device_amount);
|
||||||
});
|
});
|
||||||
|
|
||||||
backfill_layer3_device_amount.forEach(function (layer3, index) {
|
backfill_layer3_device_amount.forEach(function (layer3, index) {
|
||||||
$(`#${layer3.building_guid}_${layer3.layer3}_device_amount`).html(layer3.device_amount);
|
$(`#${layer3.building_tag}_${layer3.layer3}_device_amount`).html(layer3.device_amount);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
//#region 變更右方地圖(改為跳新分頁)
|
//#region 變更右方地圖(改為跳新分頁)
|
||||||
function ChangeFloormap(building_guid, floor_guid, device_number, layer3) {
|
function ChangeFloormap(building_tag, floor_guid, device_number, layer3) {
|
||||||
@*
|
@*
|
||||||
$("#iframe-floormap").empty();
|
$("#iframe-floormap").empty();
|
||||||
$("#iframe-floormap").append(
|
$("#iframe-floormap").append(
|
||||||
`<iframe src="http://60.251.164.125:8080/file/BajascriptTest/_FloorMap.html?building_guid=${building_guid}&floor_guid=${floor_guid}&layer3=${layer3}&device_number=${device_number}&show_cctv=1" width="100%" height="100%;" scrolling="no"></iframe>`
|
`<iframe src="http://60.251.164.125:8080/file/BajascriptTest/_FloorMap.html?building_tag=${building_tag}&floor_guid=${floor_guid}&layer3=${layer3}&device_number=${device_number}&show_cctv=1" width="100%" height="100%;" scrolling="no"></iframe>`
|
||||||
)
|
)
|
||||||
*@
|
*@
|
||||||
}
|
}
|
||||||
@ -1312,7 +1327,7 @@
|
|||||||
// de_number = $(e).parent().parent().attr('de-number');
|
// de_number = $(e).parent().parent().attr('de-number');
|
||||||
var url = "/api/EmergencyDevice/SaveAndOpenSimulationExercise";
|
var url = "/api/EmergencyDevice/SaveAndOpenSimulationExercise";
|
||||||
var send_data = {
|
var send_data = {
|
||||||
build: SelectedFilter.building_guid,
|
build: SelectedFilter.building_tag,
|
||||||
disaster: disaster,
|
disaster: disaster,
|
||||||
type: type,
|
type: type,
|
||||||
device: guid
|
device: guid
|
||||||
@ -1418,6 +1433,7 @@
|
|||||||
|
|
||||||
//#region 模擬演練 / SOP modal 開啟發送簡訊Modal
|
//#region 模擬演練 / SOP modal 開啟發送簡訊Modal
|
||||||
function OpenSendSMSModal() {
|
function OpenSendSMSModal() {
|
||||||
|
ToVerifyType = 2;
|
||||||
$('#send-sms-modal').modal();
|
$('#send-sms-modal').modal();
|
||||||
SmsMemberTable.ajax.reload();
|
SmsMemberTable.ajax.reload();
|
||||||
}
|
}
|
||||||
@ -1731,7 +1747,7 @@
|
|||||||
{
|
{
|
||||||
EmerLastsetting = $('#bigsetting').find('.active').attr('mas');
|
EmerLastsetting = $('#bigsetting').find('.active').attr('mas');
|
||||||
ToVerifyType = 0;
|
ToVerifyType = 0;
|
||||||
$('.modal-title').html("指揮官驗證");
|
//$('.modal-title').html("指揮官驗證");
|
||||||
$('#small_setting').hide();
|
$('#small_setting').hide();
|
||||||
$('#emergency_verify_input').val('');
|
$('#emergency_verify_input').val('');
|
||||||
$('#emergency-verify-modal').modal();
|
$('#emergency-verify-modal').modal();
|
||||||
@ -1783,9 +1799,6 @@
|
|||||||
$('#list_' + EmerLastsetting).find('.active').children().trigger('click');
|
$('#list_' + EmerLastsetting).find('.active').children().trigger('click');
|
||||||
$('#emergency-verify-modal').modal('hide');
|
$('#emergency-verify-modal').modal('hide');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ToVerifyType == 1) {
|
if (ToVerifyType == 1) {
|
||||||
@ -1815,6 +1828,109 @@
|
|||||||
$('#emergency-verify-modal').modal('hide');
|
$('#emergency-verify-modal').modal('hide');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(ToVerifyType == 2) {
|
||||||
|
if (Vbool) {
|
||||||
|
if(!$("#sms_messagebox").val()){
|
||||||
|
toast_warning('請輸入簡訊內容');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
controlSmsSaveBtnLoading(true);
|
||||||
|
var url = "api/EmergencyDevice/CheckVerifybool";
|
||||||
|
var send_data = {
|
||||||
|
pass: $('#sendSms_verify_input').val()
|
||||||
|
};
|
||||||
|
|
||||||
|
$.post(url, send_data, function (rel) {
|
||||||
|
if (rel.code != "0000") {
|
||||||
|
if (rel.code == "9999") {
|
||||||
|
toast_error(rel.msg);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
if (rel.data) {
|
||||||
|
Verifybool = true;
|
||||||
|
sendSmsMessage();
|
||||||
|
} else {
|
||||||
|
toast_warning('密碼驗證失敗,請重新驗證');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
controlSmsSaveBtnLoading(false);
|
||||||
|
})
|
||||||
|
} else {//取消驗證
|
||||||
|
if (EmerLastsetting == 0) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$('#small_setting').show();
|
||||||
|
$('#bigsetting').find('.active').removeClass('active');
|
||||||
|
$(`#t${EmerLastsetting}_tab`).addClass('active');
|
||||||
|
|
||||||
|
$('#small_setting').find('.show').removeClass('active show')
|
||||||
|
$(`#t${EmerLastsetting}_modal`).addClass('active show');
|
||||||
|
|
||||||
|
$('#list_' + EmerLastsetting).find('.active').children().trigger('click');
|
||||||
|
$('#emergency-verify-modal').modal('hide');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function controlSmsSaveBtnLoading(isShow = true) {
|
||||||
|
if(isShow){
|
||||||
|
$("#smsSaveBtnLoading").parent("button").prop("disabled",true);
|
||||||
|
$("#smsSaveBtnLoading").fadeIn(200);
|
||||||
|
} else {
|
||||||
|
$("#smsSaveBtnLoading").fadeOut(200);
|
||||||
|
$("#smsSaveBtnLoading").parent("button").prop("disabled",false);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function sendSmsMessage() {
|
||||||
|
if(Verifybool){
|
||||||
|
const members = SmsMemberTable.data().toArray();
|
||||||
|
const url = "api/HiNetMsg";
|
||||||
|
controlSmsSaveBtnLoading(true);
|
||||||
|
members.forEach(m => {
|
||||||
|
const send_data = {
|
||||||
|
Number:m.phone,
|
||||||
|
Msg:$("#sms_messagebox").val(),
|
||||||
|
};
|
||||||
|
$.ajax({
|
||||||
|
method:"POST",
|
||||||
|
url:url,
|
||||||
|
data:JSON.stringify(send_data),
|
||||||
|
contentType:"application/json;charset=utf-8",
|
||||||
|
success:(rel) => {
|
||||||
|
if (rel.code != "0000") {
|
||||||
|
if (rel.code == "9999") {
|
||||||
|
toast_error(rel.msg);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
if (rel.data) {
|
||||||
|
toast_ok("簡訊發送成功");
|
||||||
|
$("#send-sms-modal").modal("hide");
|
||||||
|
} else {
|
||||||
|
toast_warning('簡訊發送失敗,請重新操作');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
complete:() => {
|
||||||
|
controlSmsSaveBtnLoading(false);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
//$.post(url, JSON.stringify(send_data),{contentType:"applicaiton/json;charset=utf-8"}, function (rel) {
|
||||||
|
|
||||||
|
//})
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
toast_warning('密碼驗證失敗,請重新驗證');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function Closemodal() {
|
function Closemodal() {
|
||||||
|
@ -192,7 +192,7 @@
|
|||||||
$(row).attr('device', data.device_name);
|
$(row).attr('device', data.device_name);
|
||||||
},
|
},
|
||||||
"ajax": {
|
"ajax": {
|
||||||
"url": "/EmergencyRecord/EmergencyRecordTable",
|
"url": "/api/EmergencyRecord/EmergencyRecordTable",
|
||||||
"type": "POST",
|
"type": "POST",
|
||||||
"data": function (d) {
|
"data": function (d) {
|
||||||
d.selectaDisaster = SelectaDisaster,
|
d.selectaDisaster = SelectaDisaster,
|
||||||
@ -205,7 +205,7 @@
|
|||||||
toast_error(rel.msg);
|
toast_error(rel.msg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
data = rel.data.data;
|
data = rel.data;
|
||||||
if (data == null || data.length == 0) {
|
if (data == null || data.length == 0) {
|
||||||
|
|
||||||
this.data = [];
|
this.data = [];
|
||||||
@ -252,7 +252,7 @@
|
|||||||
$(row).attr('guid', data.emergency_item_guid);
|
$(row).attr('guid', data.emergency_item_guid);
|
||||||
},
|
},
|
||||||
"ajax": {
|
"ajax": {
|
||||||
"url": "/EmergencyRecord/EmergencyItemTable",
|
"url": "/api/EmergencyRecord/EmergencyItemTable",
|
||||||
"type": "POST",
|
"type": "POST",
|
||||||
"data": function (d) {
|
"data": function (d) {
|
||||||
d.event_guid = SelectEvent
|
d.event_guid = SelectEvent
|
||||||
@ -262,7 +262,7 @@
|
|||||||
toast_error(rel.msg);
|
toast_error(rel.msg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
data = rel.data.data;
|
data = rel.data;
|
||||||
if (data == null || data.length == 0) {
|
if (data == null || data.length == 0) {
|
||||||
|
|
||||||
this.data = [];
|
this.data = [];
|
||||||
@ -320,7 +320,7 @@
|
|||||||
|
|
||||||
//取得所有棟別
|
//取得所有棟別
|
||||||
function GetBuild() {
|
function GetBuild() {
|
||||||
var url = "/EmergencyRecord/BuildInfoList";
|
var url = "/api/EmergencyRecord/BuildInfoList";
|
||||||
var send_data = {};
|
var send_data = {};
|
||||||
$.post(url, send_data, function (rel) {
|
$.post(url, send_data, function (rel) {
|
||||||
if (rel.code != "0000") {
|
if (rel.code != "0000") {
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<title>登入 | IBMS緊急應變系統</title>
|
<title>登入 | @ViewData["ProjectName"]緊急應變系統</title>
|
||||||
|
|
||||||
<!-- base css -->
|
<!-- base css -->
|
||||||
<link id="vendorsbundle" rel="stylesheet" media="screen, print" href="~/css/vendors.bundle.css">
|
<link id="vendorsbundle" rel="stylesheet" media="screen, print" href="~/css/vendors.bundle.css">
|
||||||
@ -30,7 +30,7 @@
|
|||||||
<div class="page-logo m-0 w-100 align-items-center justify-content-center rounded border-bottom-left-radius-0 border-bottom-right-radius-0 px-4">
|
<div class="page-logo m-0 w-100 align-items-center justify-content-center rounded border-bottom-left-radius-0 border-bottom-right-radius-0 px-4">
|
||||||
<div class="page-logo-link press-scale-down d-flex align-items-center">
|
<div class="page-logo-link press-scale-down d-flex align-items-center">
|
||||||
<img src="/img/dome.png" width="50%" aria-roledescription="logo">
|
<img src="/img/dome.png" width="50%" aria-roledescription="logo">
|
||||||
<span class="page-logo-text mr-1">IBMS緊急應變系統</span>
|
<span class="page-logo-text mr-1">@ViewData["ProjectName"]緊急應變系統</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card p-4 border-top-left-radius-0 border-top-right-radius-0">
|
<div class="card p-4 border-top-left-radius-0 border-top-right-radius-0">
|
||||||
@ -78,7 +78,7 @@
|
|||||||
async: false,
|
async: false,
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
success: function (rel) {
|
success: function (rel) {
|
||||||
window.location = "/Home/Index/";
|
window.location = "/EmergencyDeviceMenu";
|
||||||
},
|
},
|
||||||
error: function (xhr, textStatus, thrownError) {
|
error: function (xhr, textStatus, thrownError) {
|
||||||
alert(textStatus);
|
alert(textStatus);
|
||||||
|
@ -253,7 +253,17 @@
|
|||||||
kind: 1
|
kind: 1
|
||||||
};
|
};
|
||||||
var url = "/RescueDevice/ExportExcel";
|
var url = "/RescueDevice/ExportExcel";
|
||||||
window.location = "/RescueDevice/ExportExcel?post=" + JSON.stringify(send_data);
|
$.ajax({
|
||||||
|
method: "POST",
|
||||||
|
xhrFields: { responseType: "blob" },
|
||||||
|
headers: { "Authorization": "Bearer " + localStorage.getItem('JWT-Authorization') },
|
||||||
|
url: "/RescueDevice/ExportExcel",
|
||||||
|
data: { "post": JSON.stringify(send_data) },
|
||||||
|
success: (res, text, xhr) => {
|
||||||
|
download(xhr, res);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
//window.location = "/RescueDevice/ExportExcel?post=" + JSON.stringify(send_data);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -253,8 +253,20 @@
|
|||||||
kind: 0
|
kind: 0
|
||||||
};
|
};
|
||||||
var url = "/RescueDevice/ExportExcel";
|
var url = "/RescueDevice/ExportExcel";
|
||||||
window.location = "/RescueDevice/ExportExcel?post=" + JSON.stringify(send_data);
|
$.ajax({
|
||||||
|
method:"POST",
|
||||||
|
xhrFields:{responseType:"blob"},
|
||||||
|
headers:{"Authorization":"Bearer " + localStorage.getItem('JWT-Authorization')},
|
||||||
|
url: "/RescueDevice/ExportExcel",
|
||||||
|
data:{"post":JSON.stringify(send_data)},
|
||||||
|
success:(res,text,xhr) => {
|
||||||
|
download(xhr,res);
|
||||||
|
}
|
||||||
|
})
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
}
|
}
|
@ -20,6 +20,7 @@
|
|||||||
//"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
|
||||||
"Root": "SzdxEgaJJ7tcTCrUl2zKsA==",
|
"Root": "SzdxEgaJJ7tcTCrUl2zKsA==",
|
||||||
"Password": "FVAPxztxpY4gJJKQ/se4bQ=="
|
"Password": "FVAPxztxpY4gJJKQ/se4bQ=="
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
//"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
|
||||||
"Root": "SzdxEgaJJ7tcTCrUl2zKsA==",
|
"Root": "SzdxEgaJJ7tcTCrUl2zKsA==",
|
||||||
"Password": "FVAPxztxpY4gJJKQ/se4bQ=="
|
"Password": "FVAPxztxpY4gJJKQ/se4bQ=="
|
||||||
},
|
},
|
||||||
|
@ -54,7 +54,7 @@ $(function () {
|
|||||||
"Please check your input."
|
"Please check your input."
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
//#region 個人資訊表單驗證
|
//#region 個人資訊表單驗證
|
||||||
@ -228,6 +228,36 @@ function SaveSpinner(status) { //1:Spinner 0:還原儲存
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下載檔案
|
||||||
|
*/
|
||||||
|
function download(res, blob, filename, fetchOption, callback = null) {
|
||||||
|
// 擷取回傳 header > content-disposition (後端定義檔案名稱)
|
||||||
|
let disposition = res.getResponseHeader("Content-Disposition");
|
||||||
|
let sDowName = "";
|
||||||
|
if (disposition) {
|
||||||
|
// 解析出名稱
|
||||||
|
sDowName = disposition.split(/filename\*=(?:utf-8'')?(.*)/gi)[1];
|
||||||
|
if (sDowName.toLowerCase().startsWith("utf-8''"))
|
||||||
|
sDowName = decodeURIComponent(sDowName.replace(/utf-8''/i, ""));
|
||||||
|
else sDowName = sDowName.replace(/['"]/g, "");
|
||||||
|
sDowName = decodeURIComponent(sDowName);
|
||||||
|
}
|
||||||
|
// 隱形a標籤
|
||||||
|
const a = document.createElement("a");
|
||||||
|
let href = URL.createObjectURL(blob);
|
||||||
|
if (href) {
|
||||||
|
a.href = href;
|
||||||
|
a.download = filename || sDowName || "";
|
||||||
|
document.body.appendChild(a);
|
||||||
|
a.click();
|
||||||
|
document.body.removeChild(a);
|
||||||
|
callback ? callback() : "";
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -244,7 +244,7 @@ namespace Repository.BackendRepository.Implement
|
|||||||
var isDome = await GetOneAsync<string>("select system_value from variable where deleted = 0 and system_type = 'project_name';");
|
var isDome = await GetOneAsync<string>("select system_value from variable where deleted = 0 and system_type = 'project_name';");
|
||||||
if (sb.Length > 0)
|
if (sb.Length > 0)
|
||||||
{
|
{
|
||||||
if (isDome == "ibms_dome_dome/D2")
|
if (isDome == "ibms_dome_dome/D2" || isDome == "ibms_dome_hotel/H")
|
||||||
{
|
{
|
||||||
sb.Append($@" update import_niagara_item a join dic_system b
|
sb.Append($@" update import_niagara_item a join dic_system b
|
||||||
on a.device_name_tag COLLATE utf8mb4_general_ci = b.s2_code
|
on a.device_name_tag COLLATE utf8mb4_general_ci = b.s2_code
|
||||||
|
Loading…
Reference in New Issue
Block a user