[WebApi]緊急應變功能修整
This commit is contained in:
parent
687b78984e
commit
877055440c
@ -1,13 +1,17 @@
|
||||
using FrontendWebApi.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using Repository.BackendRepository.Interface;
|
||||
using Repository.FrontendRepository.Interface;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.SqlTypes;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FrontendWebApi.ApiControllers
|
||||
@ -27,6 +31,51 @@ namespace FrontendWebApi.ApiControllers
|
||||
this.frontendRepository = frontendRepository;
|
||||
}
|
||||
|
||||
|
||||
[HttpPost("api/Send")]
|
||||
public async Task<ApiResult<List<Variable>>> SendMessageAsync(string message)
|
||||
{
|
||||
ApiResult<List<Variable>> apiResult = new ApiResult<List<Variable>>();
|
||||
var sqlString = "SELECT * from variable WHERE system_type = 'TcpClient'";
|
||||
var variables = await frontendRepository.GetAllAsync<Variable>(sqlString);
|
||||
var serverAddress = variables.Where(x => x.System_key == "Address").First().system_value;
|
||||
var serverPort = int.Parse(variables.Where(x => x.System_key == "Port").First().system_value);
|
||||
try
|
||||
{
|
||||
using (var client = new TcpClient())
|
||||
{
|
||||
await client.ConnectAsync(serverAddress, serverPort);
|
||||
using (var stream = client.GetStream())
|
||||
{
|
||||
var data = Encoding.UTF8.GetBytes(message);
|
||||
await stream.WriteAsync(data, 0, data.Length);
|
||||
|
||||
//data = new byte[256];
|
||||
//var bytes = await stream.ReadAsync(data, 0, data.Length);
|
||||
apiResult.Code = "0000";
|
||||
apiResult.Msg = "傳送指令, " + message;
|
||||
return apiResult;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (SocketException ex)
|
||||
{
|
||||
apiResult.Code = "9999";
|
||||
apiResult.Msg = ex.Message;
|
||||
Logger.LogError("【" + controllerName + "/" + actionName + "】" + ex.Message);
|
||||
|
||||
return apiResult;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
apiResult.Code = "9999";
|
||||
apiResult.Msg = ex.Message;
|
||||
Logger.LogError("【" + controllerName + "/" + actionName + "】" + ex.Message);
|
||||
|
||||
return apiResult;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Route("api/DisasterList")]
|
||||
public async Task<ActionResult<ApiResult<List<KeyValue>>>> DisasterList()
|
||||
@ -155,7 +204,7 @@ namespace FrontendWebApi.ApiControllers
|
||||
WHERE d.deleted = 0
|
||||
{deviceQue}
|
||||
) d
|
||||
left join floor on floor.full_name = d.device_floor_tag and floor.building_tag = d.device_building_tag
|
||||
left join floor on floor.full_name = d.device_floor_tag and floor.building_tag = d.device_building_tag and floor.deleted = 0
|
||||
left join (
|
||||
SELECT
|
||||
v.*,
|
||||
|
@ -93,7 +93,7 @@ namespace FrontendWebApi.ApiControllers
|
||||
|
||||
XDocument xmlDoc = XDocument.Parse(resString);
|
||||
|
||||
if (xmlDoc?.Root?.Name?.LocalName == "str")
|
||||
if (xmlDoc?.Root?.Name?.LocalName == "str" || xmlDoc?.Root?.Name?.LocalName == "bool")
|
||||
{
|
||||
result.targetValue = xmlDoc.Root.Attribute("val").Value;
|
||||
|
||||
@ -118,7 +118,7 @@ namespace FrontendWebApi.ApiControllers
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 取得警戒值
|
||||
/// 設定警戒值
|
||||
/// </summary>
|
||||
/// <param name="post"></param>
|
||||
/// <returns></returns>
|
||||
|
@ -8,7 +8,8 @@ namespace FrontendWebApi.Models
|
||||
{
|
||||
public enum WarningValueType {
|
||||
Rain, //降雨
|
||||
Earthquake //地震
|
||||
Earthquake , //地震
|
||||
Infrared //紅外線
|
||||
}
|
||||
|
||||
public class WarningValueInput {
|
||||
|
@ -616,6 +616,14 @@
|
||||
}
|
||||
}
|
||||
],
|
||||
'columnDefs': [
|
||||
// 隐藏第 7 列("alarm_timestamp" 列)和第 8 列(SOP 按钮列)
|
||||
{
|
||||
'targets': [7, 8],
|
||||
'visible': false,
|
||||
'searchable': false
|
||||
}
|
||||
],
|
||||
'drawCallback': function () {
|
||||
$('#alarm-device-table tbody tr td').css('padding', '5px 8px 5px 8px');
|
||||
},
|
||||
|
@ -1,12 +1,12 @@
|
||||
@{
|
||||
ViewData["MainNum"] = "4";
|
||||
ViewData["SubNum"] = "4";
|
||||
ViewData["Title"] = "紀錄查詢";
|
||||
ViewData["Title"] = "事件查詢";
|
||||
}
|
||||
|
||||
<ol class="breadcrumb page-breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="javascript:void(0);">首頁</a></li>
|
||||
<li class="breadcrumb-item active">紀錄查詢</li>
|
||||
<li class="breadcrumb-item active">事件查詢</li>
|
||||
<li class="position-absolute pos-top pos-right d-none d-sm-block"><span class="js-get-date"></span></li>
|
||||
</ol>
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
<div class="panel-content">
|
||||
<div class="subheader">
|
||||
<h1 class="subheader-title">
|
||||
<span>紀錄查詢</span>
|
||||
<span>事件查詢</span>
|
||||
</h1>
|
||||
</div>
|
||||
<div class="row mb-3 d-flex align-items-center px-3 justify-content-between">
|
||||
@ -273,11 +273,11 @@
|
||||
}
|
||||
else if (val.finished == 1)
|
||||
{
|
||||
val.type = "完成";
|
||||
val.finished = "完成";
|
||||
}
|
||||
else
|
||||
{
|
||||
val.type = "不執行";
|
||||
val.finished = "不執行";
|
||||
}
|
||||
})
|
||||
return data;
|
||||
@ -406,7 +406,10 @@
|
||||
$(this).parents().find('tr').css('background-color', '#fff');
|
||||
$(this).css('background-color', '#67B4AC');
|
||||
SelectEvent = $(this).attr('guid');
|
||||
$('#emergencyitem').find('.card-title').html("事件明細" + "-" + $(this).attr('type') + "-" + $(this).attr('device'));
|
||||
var title = "事件明細" + "-" + $(this).attr('type')
|
||||
if ($(this).attr('device') != undefined) { title += "-" + $(this).attr('device') }
|
||||
$('#emergencyitem').find('.card-title').html(title);
|
||||
// $('#emergencyitem').find('.card-title').html("事件明細" + "-" + $(this).attr('type') + "-" + $(this).attr('device'));
|
||||
EmergencyItemTable.ajax.reload();
|
||||
$('#emergencyitem').show();
|
||||
})
|
||||
|
@ -74,7 +74,6 @@
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-title">Navigation Title</li>-->
|
||||
|
||||
@if (ViewBag.role.Contains("EmergencyDeviceMenuIndex")
|
||||
|| ViewBag.role.Contains("EmergencyContactIndex")
|
||||
|| ViewBag.role.Contains("EmergencyRecordIndex")
|
||||
@ -114,41 +113,41 @@
|
||||
@if (ViewBag.role.Contains("EmergencyRecordIndex"))
|
||||
{
|
||||
<li class="@(ViewData["MainNum"] == "4" && ViewData["SubNum"] == "4" ? "active" : "")">
|
||||
<a asp-controller="EmergencyRecord" asp-action="Index" title="紀錄查詢" data-filter-tags="utilities disabled item">
|
||||
<span class="nav-link-text" data-i18n="nav.utilities_disabled_item">紀錄查詢</span>
|
||||
<a asp-controller="EmergencyRecord" asp-action="Index" title="事件查詢" data-filter-tags="utilities disabled item">
|
||||
<span class="nav-link-text" data-i18n="nav.utilities_disabled_item">事件查詢</span>
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
|
||||
@if (ViewBag.role.Contains("RescueDeviceFireExtinguisher"))
|
||||
{
|
||||
<li class="@(ViewData["MainNum"] == "4" && ViewData["SubNum"] == "5" ? "active" : "")">
|
||||
<a asp-controller="RescueDevice" asp-action="FireExtinguisher" title="滅火器設定" data-filter-tags="utilities disabled item">
|
||||
<span class="nav-link-text" data-i18n="nav.utilities_disabled_item">滅火器設定</span>
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
@if (ViewBag.role.Contains("RescueDeviceAED"))
|
||||
{
|
||||
<li class="@(ViewData["MainNum"] == "4" && ViewData["SubNum"] == "6" ? "active" : "")">
|
||||
<a asp-controller="RescueDevice" asp-action="AED" title="AED裝置設定" data-filter-tags="utilities disabled item">
|
||||
<span class="nav-link-text" data-i18n="nav.utilities_disabled_item">AED裝置設定</span>
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
@*@if (ViewBag.role.Contains("RescueDeviceFireExtinguisher"))
|
||||
{
|
||||
<li class="@(ViewData["MainNum"] == "4" && ViewData["SubNum"] == "5" ? "active" : "")">
|
||||
<a asp-controller="RescueDevice" asp-action="FireExtinguisher" title="滅火器設定" data-filter-tags="utilities disabled item">
|
||||
<span class="nav-link-text" data-i18n="nav.utilities_disabled_item">滅火器設定</span>
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
@if (ViewBag.role.Contains("RescueDeviceAED"))
|
||||
{
|
||||
<li class="@(ViewData["MainNum"] == "4" && ViewData["SubNum"] == "6" ? "active" : "")">
|
||||
<a asp-controller="RescueDevice" asp-action="AED" title="AED裝置設定" data-filter-tags="utilities disabled item">
|
||||
<span class="nav-link-text" data-i18n="nav.utilities_disabled_item">AED裝置設定</span>
|
||||
</a>
|
||||
</li>
|
||||
}*@
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
|
||||
}
|
||||
@if (ViewBag.role.Contains("WarningValueIndex"))
|
||||
@if (ViewBag.role.Contains("WarningValueIndex"))
|
||||
{
|
||||
<li class="">
|
||||
<li class="">
|
||||
<a href="#" title="警戒值設定" data-filter-tags="category" id="warningValueBtn">
|
||||
<i class="fal fa-ballot-check"></i>
|
||||
<span class="nav-link-text" data-i18n="nav.category">警戒值設定</span>
|
||||
</a>
|
||||
</li>
|
||||
</li>
|
||||
}
|
||||
|
||||
</ul>
|
||||
@ -609,33 +608,33 @@
|
||||
<div>
|
||||
<a href="@(ViewBag.BackendUrl ?? "#")" target="_blank" id="go-to-setting"><i class="fal fa-cog fs-xxl"></i></a>
|
||||
@*
|
||||
<a href="#" data-toggle="dropdown" title="drlantern@gotbootstrap.com" class="header-icon d-flex align-items-center justify-content-center ml-2">
|
||||
<img src="~/img/demo/avatars/avatar-admin.png" class="profile-image rounded-circle" alt="Dr. Codex Lantern">
|
||||
<!-- you can also add username next to the avatar with the codes below:
|
||||
<span class="ml-1 mr-1 text-truncate text-truncate-header hidden-xs-down">Me</span>
|
||||
<i class="ni ni-chevron-down hidden-xs-down"></i> -->
|
||||
</a>*@
|
||||
<a href="#" data-toggle="dropdown" title="drlantern@gotbootstrap.com" class="header-icon d-flex align-items-center justify-content-center ml-2">
|
||||
<img src="~/img/demo/avatars/avatar-admin.png" class="profile-image rounded-circle" alt="Dr. Codex Lantern">
|
||||
<!-- you can also add username next to the avatar with the codes below:
|
||||
<span class="ml-1 mr-1 text-truncate text-truncate-header hidden-xs-down">Me</span>
|
||||
<i class="ni ni-chevron-down hidden-xs-down"></i> -->
|
||||
</a>*@
|
||||
|
||||
|
||||
|
||||
@*<div class="dropdown-menu dropdown-menu-animated dropdown-lg">
|
||||
<div class="dropdown-header bg-trans-gradient d-flex flex-row py-4 rounded-top">
|
||||
<div class="d-flex flex-row align-items-center mt-1 mb-1 color-white">
|
||||
<span class="mr-2"> <img src="~/img/demo/avatars/avatar-admin.png" class="rounded-circle profile-image" alt="Dr. Codex Lantern"> </span>
|
||||
<div class="info-card-text">
|
||||
<div class="fs-lg text-truncate text-truncate-lg">@ViewBag.myUserInfo.Full_name</div>
|
||||
<span class="text-truncate text-truncate-md opacity-80">@ViewBag.myUserInfo.Email</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="dropdown-divider m-0"></div>
|
||||
<a href="javascript:void(0);" id="btn-personal-info" class="dropdown-item"> <span data-i18n="drpdwn.settings">個人資料</span> </a>
|
||||
<a href="javascript:void(0);" id="btn-change-password" class="dropdown-item"> <span data-i18n="drpdwn.settings">密碼修改</span> </a>
|
||||
<div class="dropdown-divider m-0"></div>
|
||||
<a href="#" class="dropdown-item" data-action="app-fullscreen"> <span data-i18n="drpdwn.fullscreen">Fullscreen</span> <i class="float-right text-muted fw-n">F11</i> </a> <a href="#" class="dropdown-item" data-action="app-print"> <span data-i18n="drpdwn.print">Print</span> <i class="float-right text-muted fw-n">Ctrl + P</i> </a>
|
||||
<div class="dropdown-divider m-0"></div>
|
||||
<a class="dropdown-item fw-500 pt-3 pb-3" asp-controller="Login" asp-action="SignOut"> <span data-i18n="drpdwn.page-logout">登出</span> <span class="float-right fw-n">@fic</span> </a>
|
||||
</div>*@
|
||||
<div class="dropdown-header bg-trans-gradient d-flex flex-row py-4 rounded-top">
|
||||
<div class="d-flex flex-row align-items-center mt-1 mb-1 color-white">
|
||||
<span class="mr-2"> <img src="~/img/demo/avatars/avatar-admin.png" class="rounded-circle profile-image" alt="Dr. Codex Lantern"> </span>
|
||||
<div class="info-card-text">
|
||||
<div class="fs-lg text-truncate text-truncate-lg">@ViewBag.myUserInfo.Full_name</div>
|
||||
<span class="text-truncate text-truncate-md opacity-80">@ViewBag.myUserInfo.Email</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="dropdown-divider m-0"></div>
|
||||
<a href="javascript:void(0);" id="btn-personal-info" class="dropdown-item"> <span data-i18n="drpdwn.settings">個人資料</span> </a>
|
||||
<a href="javascript:void(0);" id="btn-change-password" class="dropdown-item"> <span data-i18n="drpdwn.settings">密碼修改</span> </a>
|
||||
<div class="dropdown-divider m-0"></div>
|
||||
<a href="#" class="dropdown-item" data-action="app-fullscreen"> <span data-i18n="drpdwn.fullscreen">Fullscreen</span> <i class="float-right text-muted fw-n">F11</i> </a> <a href="#" class="dropdown-item" data-action="app-print"> <span data-i18n="drpdwn.print">Print</span> <i class="float-right text-muted fw-n">Ctrl + P</i> </a>
|
||||
<div class="dropdown-divider m-0"></div>
|
||||
<a class="dropdown-item fw-500 pt-3 pb-3" asp-controller="Login" asp-action="SignOut"> <span data-i18n="drpdwn.page-logout">登出</span> <span class="float-right fw-n">@fic</span> </a>
|
||||
</div>*@
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
@ -648,16 +647,16 @@
|
||||
<!-- BEGIN Page Footer -->
|
||||
<footer class="page-footer" role="contentinfo">
|
||||
@*<div class="d-flex align-items-center flex-1 text-muted">
|
||||
<span class="hidden-md-down fw-700">2020 © Rage by <a href='https://www.rage.com.tw' class='text-primary fw-500' title='rage.com.tw' target='_blank'>rage.com.tw</a></span>
|
||||
</div>
|
||||
<div>
|
||||
<ul class="list-table m-0">
|
||||
<li><a href="intel_introduction.html" class="text-secondary fw-700">About</a></li>
|
||||
<li class="pl-3"><a href="info_app_licensing.html" class="text-secondary fw-700">License</a></li>
|
||||
<li class="pl-3"><a href="info_app_docs.html" class="text-secondary fw-700">Documentation</a></li>
|
||||
<span class="hidden-md-down fw-700">2020 © Rage by <a href='https://www.rage.com.tw' class='text-primary fw-500' title='rage.com.tw' target='_blank'>rage.com.tw</a></span>
|
||||
</div>
|
||||
<div>
|
||||
<ul class="list-table m-0">
|
||||
<li><a href="intel_introduction.html" class="text-secondary fw-700">About</a></li>
|
||||
<li class="pl-3"><a href="info_app_licensing.html" class="text-secondary fw-700">License</a></li>
|
||||
<li class="pl-3"><a href="info_app_docs.html" class="text-secondary fw-700">Documentation</a></li>
|
||||
|
||||
</ul>
|
||||
</div>*@
|
||||
</ul>
|
||||
</div>*@
|
||||
</footer>
|
||||
<!-- END Page Footer -->
|
||||
<!-- BEGIN Color profile -->
|
||||
@ -842,10 +841,10 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 警戒值設定 -->
|
||||
<!-- 警戒值設定 -->
|
||||
<div class="modal" tabindex="-1" id="warning-value-modal" role="dialog" data-backdrop="static" data-keyboard="false">
|
||||
<div class="modal-dialog modal-dialog-centered" style="max-width:45%;">
|
||||
<div class="modal-content" style="height:600px;">
|
||||
<div class="modal-content" style="height:700px;">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">警戒值設定</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
@ -853,16 +852,16 @@
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<table class="table warning-value-table">
|
||||
<tbody>
|
||||
<table class="table warning-value-table">
|
||||
<tbody>
|
||||
<tr class="disaster-title-bar">
|
||||
<td rowspan="3" class="disaster-icon"><i class="fa-solid fa-cloud-showers-heavy"></i></td>
|
||||
<td class="disaster-title">降雨警戒設定值</td>
|
||||
<td rowspan="3" class="disaster-icon"><i class="fa-solid fa-cloud-showers-heavy"></i></td>
|
||||
<td class="disaster-title">降雨警戒設定值</td>
|
||||
<td class="disaster-value" id="rainCurName">大雨</td>
|
||||
</tr>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
<td colspan="2">
|
||||
<td colspan="2">
|
||||
<div class="form-check form-check-inline">
|
||||
<input class="form-check-input" type="radio" name="rainRadio" id="rain1" value="1">
|
||||
<label class="form-check-label" for="rain1">大雨</label>
|
||||
@ -872,26 +871,26 @@
|
||||
<label class="form-check-label" for="rain2">豪雨</label>
|
||||
</div>
|
||||
<div class="form-check form-check-inline">
|
||||
<input class="form-check-input" type="radio" name="rainRadio" id="rain3" value="3">
|
||||
<label class="form-check-label" for="rain3">大豪雨</label>
|
||||
<input class="form-check-input" type="radio" name="rainRadio" id="rain3" value="3">
|
||||
<label class="form-check-label" for="rain3">大豪雨</label>
|
||||
</div>
|
||||
<div class="form-check form-check-inline">
|
||||
<input class="form-check-input" type="radio" name="rainRadio" id="rain4" value="4">
|
||||
<label class="form-check-label" for="rain4">超大豪雨</label>
|
||||
<input class="form-check-input" type="radio" name="rainRadio" id="rain4" value="4">
|
||||
<label class="form-check-label" for="rain4">超大豪雨</label>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
<td colspan="2" id="rainDesc">24小時累積雨量達80毫米以上,或時雨量達40毫米以上之降雨現象</td>
|
||||
</tr>
|
||||
<td colspan="2" id="rainDesc">24小時累積雨量達80毫米以上,或時雨量達40毫米以上之降雨現象</td>
|
||||
</tr>
|
||||
<tr class="disaster-title-bar">
|
||||
<td rowspan="3" class="disaster-icon"><i class="fa-solid fa-house-chimney-crack"></i></td>
|
||||
<td class="disaster-title">地震警戒設定值</td>
|
||||
<td class="disaster-value" id="eqCurName">7級</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<td class="disaster-value" id="eqCurName"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<div class="form-check form-check-inline">
|
||||
<input class="form-check-input" type="radio" name="eqRadio" id="eq1" value="3">
|
||||
<label class="form-check-label" for="inlineRadio1">3級</label>
|
||||
@ -901,27 +900,40 @@
|
||||
<label class="form-check-label" for="eq2">4級</label>
|
||||
</div>
|
||||
<div class="form-check form-check-inline">
|
||||
<input class="form-check-input" type="radio" name="eqRadio" id="eq3" value="5">
|
||||
<label class="form-check-label" for="eq3">5級</label>
|
||||
<input class="form-check-input" type="radio" name="eqRadio" id="eq3" value="5">
|
||||
<label class="form-check-label" for="eq3">5級</label>
|
||||
</div>
|
||||
<div class="form-check form-check-inline">
|
||||
<input class="form-check-input" type="radio" name="eqRadio" id="eq4" value="6">
|
||||
<label class="form-check-label" for="eq4">6級</label>
|
||||
<input class="form-check-input" type="radio" name="eqRadio" id="eq4" value="6">
|
||||
<label class="form-check-label" for="eq4">6級</label>
|
||||
</div>
|
||||
<div class="form-check form-check-inline">
|
||||
<input class="form-check-input" type="radio" name="eqRadio" id="eq5" value="7">
|
||||
<label class="form-check-label" for="eq5">7級</label>
|
||||
<div class="form-check form-check-inline">
|
||||
<input class="form-check-input" type="radio" name="eqRadio" id="eq5" value="7">
|
||||
<label class="form-check-label" for="eq5">7級</label>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" id="eqDesc">幾乎所有家俱都大幅移動或翻倒,部分耐震較強建築物可能損壞或倒塌。</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" id="eqDesc">幾乎所有家俱都大幅移動或翻倒,部分耐震較強建築物可能損壞或倒塌。</td>
|
||||
</tr>
|
||||
<tr class="disaster-title-bar">
|
||||
<td rowspan="2" class="disaster-icon"><i class="fa-solid fa-bolt"></i></td>
|
||||
<td class="disaster-title">紅外線抑制</td>
|
||||
<td class="disaster-value"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="irCheckbox" name="irCheckbox" value="open">
|
||||
<label class="form-check-label" for="irCheckbox">開啟</label>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
|
||||
<button type="button" class="btn btn-primary btn-save" onclick="setWarningValue()">儲存</button>
|
||||
</div>
|
||||
@ -966,52 +978,52 @@
|
||||
@RenderSection("Scripts", required: false)
|
||||
|
||||
<script>
|
||||
function showWarningValueModal(e){
|
||||
function showWarningValueModal(e) {
|
||||
$("#warning-value-modal").modal("show");
|
||||
}
|
||||
|
||||
$("body").on("click","#warningValueBtn",showWarningValueModal);
|
||||
$("body").on("click", "#warningValueBtn", showWarningValueModal);
|
||||
|
||||
$("body").on("hidden.bs.modal","#warning-value-modal",function() {
|
||||
$("#warningValueIframe").attr("src","#");
|
||||
$("body").on("hidden.bs.modal", "#warning-value-modal", function () {
|
||||
$("#warningValueIframe").attr("src", "#");
|
||||
});
|
||||
|
||||
$("body").on("shown.bs.modal","#warning-value-modal",function() {
|
||||
$("#warningValueIframe").attr("src","@ViewBag.WarningValuePxPath");
|
||||
$("body").on("shown.bs.modal", "#warning-value-modal", function () {
|
||||
$("#warningValueIframe").attr("src", "@ViewBag.WarningValuePxPath");
|
||||
});
|
||||
|
||||
$("body").on("show.bs.modal","#warning-value-modal",getWarningValue);
|
||||
$("body").on("show.bs.modal", "#warning-value-modal", getWarningValue);
|
||||
|
||||
$("body").on("change","input[name=rainRadio]",onRainRadioChange);
|
||||
$("body").on("change","input[name=eqRadio]",onEqRadioChange);
|
||||
$("body").on("change", "input[name=rainRadio]", onRainRadioChange);
|
||||
$("body").on("change", "input[name=eqRadio]", onEqRadioChange);
|
||||
|
||||
function onRainRadioChange(e) {
|
||||
let rainDecDict = {
|
||||
1:"24小時累積雨量達80毫米以上,或時雨量達40毫米以上之降雨現象。",
|
||||
2:"24小時累積雨量達200毫米以上,或3小時累積雨量達100毫米以上之降雨現象。",
|
||||
3:"24小時累積雨量達350毫米以上之降雨現象。",
|
||||
4:"24小時累積雨量達500毫米以上之降雨現象。",
|
||||
1: "24小時累積雨量達80毫米以上,或時雨量達40毫米以上之降雨現象。",
|
||||
2: "24小時累積雨量達200毫米以上,或3小時累積雨量達100毫米以上之降雨現象。",
|
||||
3: "24小時累積雨量達350毫米以上之降雨現象。",
|
||||
4: "24小時累積雨量達500毫米以上之降雨現象。",
|
||||
};
|
||||
|
||||
$("#rainDesc").text(rainDecDict[e.target.value] || "");
|
||||
}
|
||||
|
||||
function onEqRadioChange(e){
|
||||
function onEqRadioChange(e) {
|
||||
let eqDecDict = {
|
||||
3:"房屋震動,碗盤門窗發出聲音,懸掛物搖擺。",
|
||||
4:"房屋搖動甚烈,少數未固定物品可能傾倒掉落,少數傢俱移動,可能有輕微災害。",
|
||||
5:"部分未固定物品傾倒掉落,少數傢俱可能移動或翻倒,少數門窗可能變形,部分牆壁產生裂痕。",
|
||||
6:"大量傢俱大幅移動或翻倒,門窗扭曲變形,部分耐震能力較差房屋可能損壞或倒塌。",
|
||||
7:"幾乎所有傢俱都大幅移動或翻倒,部分耐震較強建築物可能損壞或倒塌。",
|
||||
3: "房屋震動,碗盤門窗發出聲音,懸掛物搖擺。",
|
||||
4: "房屋搖動甚烈,少數未固定物品可能傾倒掉落,少數傢俱移動,可能有輕微災害。",
|
||||
5: "部分未固定物品傾倒掉落,少數傢俱可能移動或翻倒,少數門窗可能變形,部分牆壁產生裂痕。",
|
||||
6: "大量傢俱大幅移動或翻倒,門窗扭曲變形,部分耐震能力較差房屋可能損壞或倒塌。",
|
||||
7: "幾乎所有傢俱都大幅移動或翻倒,部分耐震較強建築物可能損壞或倒塌。",
|
||||
}
|
||||
|
||||
$("#eqDesc").text(eqDecDict[e.target.value] || "");
|
||||
}
|
||||
|
||||
function getWarningValue(){
|
||||
function getWarningValue() {
|
||||
let url = "/api/WarningValue/GetWarningValue";
|
||||
|
||||
$.post(url, {}, function (rel) {
|
||||
$.post(url, {}, function (rel) {
|
||||
if (rel.code != "0000") {
|
||||
if (rel.code == "9999") {
|
||||
toast_error(rel.msg);
|
||||
@ -1019,34 +1031,56 @@
|
||||
return;
|
||||
}
|
||||
else {
|
||||
if(rel.data){
|
||||
if (rel.data) {
|
||||
let irValue = rel.data.filter(d => d.type == 2).map(d => d.targetValue)[0];
|
||||
let eqValue = rel.data.filter(d => d.type == 1).map(d => d.targetValue)[0];
|
||||
let rainValue = rel.data.filter(d => d.type == 0).map(d => d.targetValue)[0];
|
||||
if (irValue == "true") {
|
||||
$(`input[name=irCheckbox][value=open]`).prop("checked", true);
|
||||
} else { $(`input[name=irCheckbox][value=open]`).prop("checked", false); }
|
||||
|
||||
$(`input[name=rainRadio][value=${rainValue}]`).prop("checked",true);
|
||||
$(`input[name=eqRadio][value=${eqValue}]`).prop("checked",true);
|
||||
$(`input[name=rainRadio][value=${rainValue}]`).prop("checked", true);
|
||||
$(`input[name=eqRadio][value=${eqValue}]`).prop("checked", true);
|
||||
$("#rainCurName").text($(`input[name=rainRadio][value=${rainValue}]`).next("label").text());
|
||||
$("#eqCurName").text($(`input[name=eqRadio][value=${eqValue}]`).next("label").text());
|
||||
let rainDecDict = {
|
||||
1: "24小時累積雨量達80毫米以上,或時雨量達40毫米以上之降雨現象。",
|
||||
2: "24小時累積雨量達200毫米以上,或3小時累積雨量達100毫米以上之降雨現象。",
|
||||
3: "24小時累積雨量達350毫米以上之降雨現象。",
|
||||
4: "24小時累積雨量達500毫米以上之降雨現象。",
|
||||
};
|
||||
|
||||
$("#rainDesc").text(rainDecDict[rainValue] || "");
|
||||
let eqDecDict = {
|
||||
3: "房屋震動,碗盤門窗發出聲音,懸掛物搖擺。",
|
||||
4: "房屋搖動甚烈,少數未固定物品可能傾倒掉落,少數傢俱移動,可能有輕微災害。",
|
||||
5: "部分未固定物品傾倒掉落,少數傢俱可能移動或翻倒,少數門窗可能變形,部分牆壁產生裂痕。",
|
||||
6: "大量傢俱大幅移動或翻倒,門窗扭曲變形,部分耐震能力較差房屋可能損壞或倒塌。",
|
||||
7: "幾乎所有傢俱都大幅移動或翻倒,部分耐震較強建築物可能損壞或倒塌。",
|
||||
}
|
||||
|
||||
$("#eqDesc").text(eqDecDict[eqValue] || "");
|
||||
}
|
||||
|
||||
}
|
||||
}, 'json');
|
||||
}
|
||||
|
||||
function setWarningValue(){
|
||||
function setWarningValue() {
|
||||
let irValue = $("input[name=irCheckbox]").is(":checked");
|
||||
let eqValue = $("input[name=eqRadio]:checked").val();
|
||||
let rainValue = $("input[name=rainRadio]:checked").val();
|
||||
|
||||
if(!eqValue || !rainValue){
|
||||
if (!eqValue || !rainValue) {
|
||||
toast_error("請輸入警戒值");
|
||||
return;
|
||||
}
|
||||
|
||||
let sendData = {wvs:
|
||||
[
|
||||
{type:0,targetValue:rainValue},
|
||||
{type:1,targetValue:eqValue}
|
||||
]
|
||||
let sendData = {
|
||||
wvs:
|
||||
[
|
||||
{ type: 0, targetValue: rainValue },
|
||||
{ type: 1, targetValue: eqValue },
|
||||
{ type: 2, targetValue: irValue }
|
||||
]
|
||||
};
|
||||
|
||||
let url = "/api/WarningValue/SetWarningValue";
|
||||
|
@ -10,7 +10,7 @@
|
||||
"JwtSettings": {
|
||||
"Issuer": "Admin", //<EFBFBD>o<EFBFBD>e<EFBFBD><EFBFBD>
|
||||
"SignKey": "TaipeiDome123456", //ñ<EFBFBD><EFBFBD>//<EFBFBD>̤<EFBFBD>16<EFBFBD>r<EFBFBD><EFBFBD>
|
||||
"JwtLifeSeconds": 3600
|
||||
"JwtLifeSeconds": 86400
|
||||
},
|
||||
"FilePath": {
|
||||
"OutputForm": "C:\\jay.chang\\ibms\\FrontendWebApi\\wwwroot\\upload\\OutputForm\\", //水電報表 檔案儲存位置
|
||||
|
@ -1567,6 +1567,7 @@ namespace Repository.BackendRepository.Implement
|
||||
{
|
||||
try
|
||||
{
|
||||
await conn.ExecuteAsync("TRUNCATE TABLE device_disaster");
|
||||
stopwatchSection = new Stopwatch();
|
||||
stopwatchSection.Start();
|
||||
sb.Append("select * from device_disaster;");
|
||||
@ -1594,7 +1595,24 @@ namespace Repository.BackendRepository.Implement
|
||||
|
||||
stopwatchSection = new Stopwatch();
|
||||
stopwatchSection.Start();
|
||||
dv = dv.Where(x => device.Any(d => d.device_number == x.value.Split('/')[6])).ToList();
|
||||
// 過濾 dv 集合,只保留設備編號有效的項目
|
||||
dv = dv.Where(x =>
|
||||
{
|
||||
string[] parts = x.value.Split('/');
|
||||
// 確認陣列長度是否足夠長,並且設備編號(索引為6)存在於 device 集合中
|
||||
if (parts.Length > 6)
|
||||
{
|
||||
string deviceNumber = parts[6];
|
||||
return device.Any(d => d.device_number == deviceNumber);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果陣列長度不足,或者設備編號無效,則返回 false,表示不保留此項目
|
||||
return false;
|
||||
}
|
||||
}).ToList();
|
||||
|
||||
//dv = dv.Where(x => device.Any(d => d.device_number == x.value.Split('/')[6])).ToList();
|
||||
sb.Clear();
|
||||
var updateList = dv.Where(x => deviceDisaster.Any(dd => dd.device_number == x.value.Split('/')[6] && dd.device_system_value != x.disasterValue)).ToList();
|
||||
foreach (var d in updateList)
|
||||
|
Loading…
Reference in New Issue
Block a user