Compare commits
No commits in common. "b97828ca6a6452e71884bfd6c26fe945fc6fdfb6" and "49de1960e6acb0f046d6a295a2d27443c10203e9" have entirely different histories.
b97828ca6a
...
49de1960e6
@ -167,11 +167,7 @@ namespace Backend.Controllers
|
||||
|
||||
buildMenu.left_system_url = string.Format("http://{0}:{1}{2}", building.Ip_address, building.Ip_port, buildMenu.left_system_url);
|
||||
}
|
||||
if (buildMenu.left_planimetric_click == 1)
|
||||
{
|
||||
dictionary.Add("@left_icon_click_url_width", buildMenu.left_icon_click_url_width);
|
||||
dictionary.Add("@left_icon_click_url_height", buildMenu.left_icon_click_url_height);
|
||||
}
|
||||
|
||||
dictionary.Add("@left_system_url", buildMenu.left_system_url);
|
||||
}
|
||||
else if (buildMenu.left_drawing == 4)
|
||||
@ -188,12 +184,9 @@ namespace Backend.Controllers
|
||||
dictionary.Add("@left_riser_diagram_url", buildMenu.left_riser_diagram_url);
|
||||
dictionary.Add("@left_icon_click", buildMenu.left_icon_click);
|
||||
dictionary.Add("@left_icon_click_url", buildMenu.left_icon_click_url);
|
||||
if (buildMenu.left_icon_click == 1 || buildMenu.left_planimetric_click == 1)
|
||||
{
|
||||
dictionary.Add("@left_icon_click_url_width", buildMenu.left_icon_click_url_width);
|
||||
dictionary.Add("@left_icon_click_url_height", buildMenu.left_icon_click_url_height);
|
||||
}
|
||||
}
|
||||
else if (buildMenu.left_drawing == 1)
|
||||
{
|
||||
dictionary.Add("@planimetric_floor_guid", buildMenu.left_planimetric_floor_guid);
|
||||
@ -300,11 +293,7 @@ namespace Backend.Controllers
|
||||
|
||||
buildMenu.left_system_url = string.Format("http://{0}:{1}{2}", building.Ip_address, building.Ip_port, buildMenu.left_system_url);
|
||||
}
|
||||
if (buildMenu.left_planimetric_click == 1)
|
||||
{
|
||||
dictionary.Add("@left_icon_click_url_width", buildMenu.left_icon_click_url_width);
|
||||
dictionary.Add("@left_icon_click_url_height", buildMenu.left_icon_click_url_height);
|
||||
}
|
||||
|
||||
dictionary.Add("@left_system_url", buildMenu.left_system_url);
|
||||
}
|
||||
else if (buildMenu.left_drawing == 4)
|
||||
@ -321,12 +310,9 @@ namespace Backend.Controllers
|
||||
dictionary.Add("@left_riser_diagram_url", buildMenu.left_riser_diagram_url);
|
||||
dictionary.Add("@left_icon_click", buildMenu.left_icon_click);
|
||||
dictionary.Add("@left_icon_click_url", buildMenu.left_icon_click_url);
|
||||
if (buildMenu.left_icon_click == 1 || buildMenu.left_planimetric_click == 1)
|
||||
{
|
||||
dictionary.Add("@left_icon_click_url_width", buildMenu.left_icon_click_url_width);
|
||||
dictionary.Add("@left_icon_click_url_height", buildMenu.left_icon_click_url_height);
|
||||
}
|
||||
}
|
||||
else if (buildMenu.left_drawing == 1)
|
||||
{
|
||||
dictionary.Add("@left_planimetric_floor_guid", buildMenu.left_planimetric_floor_guid);
|
||||
|
@ -137,7 +137,7 @@ namespace Backend.Controllers
|
||||
string random_password = new string(Enumerable.Repeat(chars, 8).Select(s => s[random.Next(chars.Length)]).ToArray());
|
||||
|
||||
//var newPassword = edFunction.GetSHA256Encryption(random_password);
|
||||
var newPassword = edFunction.GetSHA256Encryption(post.Password);
|
||||
var newPassword = edFunction.GetSHA256Encryption("123456");
|
||||
|
||||
//產生一組GUID
|
||||
var guid = Guid.NewGuid(); //使用者GUID
|
||||
|
@ -60,7 +60,6 @@ namespace Backend.Models
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public string Name { get; set; } //姓名
|
||||
public string Password { get; set; } //密碼
|
||||
public string Email { get; set; } //信箱
|
||||
public string Account { get; set; } //帳號
|
||||
public string Phone { get; set; } //手機號碼
|
||||
|
@ -869,16 +869,15 @@
|
||||
changebuild_menu_drawing_modal(this);
|
||||
});
|
||||
//#endregion
|
||||
|
||||
// $('#build_menu_icon_click_onoff_modal_div').on("click", "input[type=checkbox]", function () {
|
||||
// if ($(this).prop("checked") && $(this).val() == 1) {
|
||||
$('#build_menu_icon_click_onoff_modal_div').on("click", "input[type=checkbox]", function () {
|
||||
if ($(this).prop("checked") && $(this).val() == 1) {
|
||||
//$('#build_menu_icon_click_url_modal_div').show();
|
||||
// $('#build_menu_icon_click_url_width_height_modal_div').show();
|
||||
// } else {
|
||||
$('#build_menu_icon_click_url_width_height_modal_div').show();
|
||||
} else {
|
||||
//$('#build_menu_icon_click_url_modal_div').hide();
|
||||
// $('#build_menu_icon_click_url_width_height_modal_div').hide();
|
||||
// }
|
||||
// });
|
||||
$('#build_menu_icon_click_url_width_height_modal_div').hide();
|
||||
}
|
||||
});
|
||||
|
||||
$('#build_menu_icon_click_onoff_modal_div_r').on("click", "input[type=checkbox]", function () {
|
||||
if ($(this).prop("checked") && $(this).val() == 1) {
|
||||
@ -1058,131 +1057,43 @@
|
||||
}, 'json');
|
||||
});
|
||||
//#endregion
|
||||
|
||||
function changebuild_menu_drawing_modal(selector = "input[name^='drawing']:checked") {
|
||||
$(selector).each(function (index, value) {
|
||||
let drawingParent = $(value).parents("[id^=build_menu_position]");
|
||||
|
||||
// 重置所有相關的 modal
|
||||
$(selector).each(function (index, value) {
|
||||
let drawingParent = $(value).parents("[id^=build_menu_position]")
|
||||
$(drawingParent).find('[id^=build_menu_icon_click_onoff_modal_div]').hide();
|
||||
$(drawingParent).find('[id^=build_menu_blankurl_modal_div]').hide();
|
||||
//$(drawingParent).find('[id^=build_menu_icon_click_url_modal_div]').hide();
|
||||
$(drawingParent).find('[id^=build_menu_icon_click_url_width_height_modal_div]').hide();
|
||||
$(drawingParent).find('[id^=build_menu_planimetric_floor_modal_div]').hide();
|
||||
$(drawingParent).find('[id^=build_menu_systemurl_modal_div]').hide();
|
||||
$(drawingParent).find('[id^=build_menu_planimetric_modal_div]').show();
|
||||
|
||||
// 根據 input 的值設定顯示/隱藏邏輯
|
||||
switch ($(value).val()) {
|
||||
case '2':
|
||||
if ($(value).val() == 2) {
|
||||
$(drawingParent).find('[id^=planimetric_click]').attr("disabled", false);
|
||||
$(drawingParent).find('[id^=build_menu_systemurl_modal_div]').show();
|
||||
|
||||
function toggleModalVisibilityCase2() {
|
||||
const planimetricChecked = $(drawingParent).find('#build_menu_planimetric_modal_div input[type=checkbox]').is(":checked");
|
||||
if (planimetricChecked) {
|
||||
$(drawingParent).find('#build_menu_icon_click_url_width_height_modal_div').show();
|
||||
} else {
|
||||
$(drawingParent).find('#build_menu_icon_click_url_width_height_modal_div').hide();
|
||||
}
|
||||
}
|
||||
|
||||
$(drawingParent).find('#build_menu_planimetric_modal_div').on("click", "input[type=checkbox]", function () {
|
||||
toggleModalVisibilityCase2();
|
||||
});
|
||||
|
||||
toggleModalVisibilityCase2(); // 初始化時也要檢查一次
|
||||
break;
|
||||
|
||||
case '4':
|
||||
$(drawingParent).find('[id^=planimetric_click]').attr("disabled", false);
|
||||
} else if ($(value).val() == 4) {
|
||||
$(drawingParent).find('[id^="planimetric_click"]').attr("disabled", false);
|
||||
$(drawingParent).find('[id^=build_menu_icon_click_onoff_modal_div]').show();
|
||||
|
||||
function toggleModalVisibilityCase4() {
|
||||
const planimetricChecked = $(drawingParent).find('#build_menu_planimetric_modal_div input[type=checkbox]').is(":checked");
|
||||
const onoffChecked = $(drawingParent).find('#build_menu_icon_click_onoff_modal_div input[type=checkbox]').is(":checked");
|
||||
|
||||
if (planimetricChecked || onoffChecked) {
|
||||
$(drawingParent).find('#build_menu_icon_click_url_width_height_modal_div').show();
|
||||
} else {
|
||||
$(drawingParent).find('#build_menu_icon_click_url_width_height_modal_div').hide();
|
||||
if ($(drawingParent).find("[id^=icon_click_url]").prop('checked')) {
|
||||
//$(drawingParent).find('[id^=build_menu_icon_click_url_modal_div]').show();
|
||||
$(drawingParent).find('[id^=build_menu_icon_click_url_width_height_modal_div]').show();
|
||||
}
|
||||
}
|
||||
|
||||
$(drawingParent).find('#build_menu_planimetric_modal_div').on("click", "input[type=checkbox]", function () {
|
||||
toggleModalVisibilityCase4();
|
||||
});
|
||||
|
||||
$(drawingParent).find('#build_menu_icon_click_onoff_modal_div').on("click", "input[type=checkbox]", function () {
|
||||
toggleModalVisibilityCase4();
|
||||
});
|
||||
|
||||
toggleModalVisibilityCase4(); // 初始化時也要檢查一次
|
||||
break;
|
||||
|
||||
case '1':
|
||||
} else if ($(value).val() == 1) {
|
||||
$(drawingParent).find('[id^=planimetric_click]').prop("checked", true).attr("disabled", true);
|
||||
$(drawingParent).find('[id^=build_menu_planimetric_floor_modal_div]').show();
|
||||
break;
|
||||
|
||||
case '5':
|
||||
} else if ($(value).val() == 5) {
|
||||
$(drawingParent).find('[id^=planimetric_click]').prop("checked", false);
|
||||
$(drawingParent).find('[id^=build_menu_blankurl_modal_div]').show();
|
||||
break;
|
||||
|
||||
case '3':
|
||||
} else if ($(value).val() == 3) {
|
||||
$(drawingParent).find('[id^=planimetric_click]').prop("checked", false).attr("disabled", true);
|
||||
break;
|
||||
|
||||
default:
|
||||
} else {
|
||||
$(drawingParent).find('[id^=build_menu_planimetric_modal_div]').hide();
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
// function changebuild_menu_drawing_modal(selector = "input[name^='drawing']:checked") {
|
||||
|
||||
// $(selector).each(function (index, value) {
|
||||
// let drawingParent = $(value).parents("[id^=build_menu_position]")
|
||||
// $(drawingParent).find('[id^=build_menu_icon_click_onoff_modal_div]').hide();
|
||||
// $(drawingParent).find('[id^=build_menu_blankurl_modal_div]').hide();
|
||||
// $(drawingParent).find('[id^=build_menu_icon_click_url_modal_div]').hide();
|
||||
// $(drawingParent).find('[id^=build_menu_icon_click_url_width_height_modal_div]').hide();
|
||||
// $(drawingParent).find('[id^=build_menu_planimetric_floor_modal_div]').hide();
|
||||
// $(drawingParent).find('[id^=build_menu_systemurl_modal_div]').hide();
|
||||
// $(drawingParent).find('[id^=build_menu_planimetric_modal_div]').show();
|
||||
// if ($(value).val() == 2) {
|
||||
// $(drawingParent).find('[id^=planimetric_click]').attr("disabled", false);
|
||||
// $(drawingParent).find('[id^=build_menu_systemurl_modal_div]').show();
|
||||
// if ($(drawingParent).find("[id^=planimetric_click]").prop('checked')) {
|
||||
// $(drawingParent).find('[id^=build_menu_icon_click_url_width_height_modal_div]').show();
|
||||
// }
|
||||
// } else if ($(value).val() == 4) {
|
||||
// $(drawingParent).find('[id^="planimetric_click"]').attr("disabled", false);
|
||||
// $(drawingParent).find('[id^=build_menu_icon_click_onoff_modal_div]').show();
|
||||
// if ($(drawingParent).find("[id^=icon_click_url]").prop('checked')) {
|
||||
// $(drawingParent).find('[id^=build_menu_icon_click_url_modal_div]').show();
|
||||
// $(drawingParent).find('[id^=build_menu_icon_click_url_width_height_modal_div]').show();
|
||||
// }
|
||||
// } else if ($(value).val() == 1) {
|
||||
// $(drawingParent).find('[id^=planimetric_click]').prop("checked", true).attr("disabled", true);
|
||||
// $(drawingParent).find('[id^=build_menu_planimetric_floor_modal_div]').show();
|
||||
// } else if ($(value).val() == 5) {
|
||||
// $(drawingParent).find('[id^=planimetric_click]').prop("checked", false);
|
||||
// $(drawingParent).find('[id^=build_menu_blankurl_modal_div]').show();
|
||||
// } else if ($(value).val() == 3) {
|
||||
// $(drawingParent).find('[id^=planimetric_click]').prop("checked", false).attr("disabled", true);
|
||||
// } else {
|
||||
// $(drawingParent).find('[id^=build_menu_planimetric_modal_div]').hide();
|
||||
// }
|
||||
|
||||
// })
|
||||
|
||||
|
||||
// }
|
||||
}
|
||||
$('#buildMenu_table').on("click", "button.del-btn", function () {
|
||||
|
||||
var send_data = {
|
||||
|
@ -2951,15 +2951,10 @@
|
||||
return;
|
||||
}
|
||||
|
||||
var normalValue = $("#device_normal_point_value_modal").val();
|
||||
var closeValue = $("#device_close_point_value_modal").val();
|
||||
|
||||
if (normalValue != "" && closeValue != "" && normalValue != null && closeValue != null) {
|
||||
if (normalValue == closeValue) {
|
||||
if ($("#device_normal_point_value_modal").val() == $("#device_close_point_value_modal").val()) {
|
||||
toast_warning("點位值設定重複,請修改");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ($("#device-kind-form").valid()) {
|
||||
|
||||
|
@ -329,7 +329,6 @@
|
||||
var send_data = {
|
||||
Id: selected_id,
|
||||
Name: $("#user_name_modal").val(),
|
||||
Password: $("#user_password_modal").val(),
|
||||
Email: $("#user_email_modal").val(),
|
||||
Account: $("#user_account_modal").val(),
|
||||
Phone: $("#user_phone_modal").val(),
|
||||
|
@ -63,7 +63,7 @@
|
||||
|
||||
<div class="form-group col-lg-6 user-password-div">
|
||||
<label class="form-label" for="user_password_modal">密碼</label>
|
||||
<input type="password" id="user_password_modal" name="user_password_modal" class="form-control">
|
||||
<input type="password" id="user_password_modal" name="user_password_modal" class="form-control" placeholder="由系統產生" disabled>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-lg-6">
|
||||
|
@ -1127,9 +1127,9 @@ namespace BackendWorkerService.Quartz.Jobs
|
||||
|
||||
var endDay = System.DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd");
|
||||
|
||||
foreach (DateTime month in EachMonth(startDay, endDay))
|
||||
foreach (DateTime day in EachMonth(startDay, endDay))
|
||||
{
|
||||
if (month.ToString("yyyy-MM") == System.DateTime.Now.AddDays(-1).ToString("yyyy-MM"))
|
||||
if (day.ToString("yyyy-MM") == System.DateTime.Now.AddDays(-1).ToString("yyyy-MM"))
|
||||
{
|
||||
var preDay = now.AddDays(-1); //取得前一天
|
||||
|
||||
@ -1154,9 +1154,9 @@ namespace BackendWorkerService.Quartz.Jobs
|
||||
}
|
||||
else
|
||||
{
|
||||
var dayInMonth = DateTime.DaysInMonth(month.Year, month.Month);
|
||||
var FirstDay = new DateTime(month.Year, month.Month, 1);
|
||||
var LastDay = new DateTime(month.Year, month.Month, dayInMonth);
|
||||
var dayInMonth = DateTime.DaysInMonth(day.Year, day.Month);
|
||||
var FirstDay = new DateTime(day.Year, day.Month, 1);
|
||||
var LastDay = new DateTime(day.Year, day.Month, dayInMonth);
|
||||
|
||||
startTimestamp = string.Format("{0}T00:00:00.000+08:00", FirstDay.ToString("yyyy-MM-dd"));
|
||||
|
||||
@ -1270,7 +1270,7 @@ namespace BackendWorkerService.Quartz.Jobs
|
||||
{
|
||||
var dayInMonth = DateTime.DaysInMonth(day.Year, day.Month);
|
||||
var FirstDay = new DateTime(day.Year, day.Month, 1);
|
||||
var LastDay = new DateTime(day.Year, day.Month, dayInMonth).AddDays(1);
|
||||
var LastDay = new DateTime(day.Year, day.Month, dayInMonth);
|
||||
|
||||
startTimestamp = string.Format("{0}T00:00:00.000+08:00", FirstDay.ToString("yyyy-MM-dd"));
|
||||
|
||||
@ -1746,11 +1746,9 @@ namespace BackendWorkerService.Quartz.Jobs
|
||||
{
|
||||
var strtday = DateTime.Parse(from);
|
||||
var endday = DateTime.Parse(thru);
|
||||
|
||||
for (var _month = strtday.Date; _month <= endday; _month = _month.AddMonths(1))
|
||||
{
|
||||
for (var _month = strtday.Date; _month.Month <= endday.Month; _month = _month.AddMonths(1))
|
||||
yield return _month;
|
||||
}
|
||||
|
||||
}
|
||||
private List<Dictionary<string, object>> ArrangeRawData(DeviceNumberPoint deviceNumberPoint, JObject jsonResult)
|
||||
{
|
||||
|
@ -1,7 +1,6 @@
|
||||
using FrontendWebApi.Models;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Quartz;
|
||||
using Repository.BackendRepository.Implement;
|
||||
using Repository.BackendRepository.Interface;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -53,10 +52,8 @@ namespace BackendWorkerService.Quartz.Jobs
|
||||
|
||||
using (HttpClient client = new HttpClient())
|
||||
{
|
||||
var sqlObix = $@"SELECT system_value as Value, system_key as Name FROM variable WHERE deleted = 0 AND system_type = 'obixConfig'";
|
||||
var variableObix = backendRepository.GetAllAsync<KeyValue>(sqlObix).Result;
|
||||
string username = variableObix.Where(x => x.Name == "UserName").Select(x => x.Value).FirstOrDefault();
|
||||
string password = variableObix.Where(x => x.Name == "Password").Select(x => x.Value).FirstOrDefault();
|
||||
string username = "stanGG";
|
||||
string password = "St12345678";
|
||||
string encoded = Convert.ToBase64String(System.Text.Encoding.GetEncoding("ISO-8859-1").GetBytes(username + ":" + password));
|
||||
|
||||
client.DefaultRequestHeaders.Add("Authorization", "Basic " + encoded);
|
||||
@ -91,8 +88,7 @@ namespace BackendWorkerService.Quartz.Jobs
|
||||
|
||||
foreach (var obj in filteredObjs)
|
||||
{
|
||||
var guid = obj.Descendants().Where(d => d.Name.LocalName == "str" && d.Attribute("name").Value == "niagara-uuid").
|
||||
Select(x => x.Attribute("val").Value).FirstOrDefault();
|
||||
var newguid = Guid.NewGuid();
|
||||
var alarm_timestamp = obj.Descendants().Where(d => d.Name.LocalName == "abstime" && d.Attribute("name").Value == "timestamp")
|
||||
.Select(d =>
|
||||
{
|
||||
@ -114,7 +110,7 @@ namespace BackendWorkerService.Quartz.Jobs
|
||||
|
||||
var dictionary = new Dictionary<string, object>()
|
||||
{
|
||||
{"@emergency_event_guid",guid},
|
||||
{"@emergency_event_guid",newguid},
|
||||
{"@disaster",filterDevice.device_system_value},
|
||||
{"@building_tag", filterDevice.device_building_tag},
|
||||
{"@device_guid",filterDevice.device_guid },
|
||||
@ -124,7 +120,7 @@ namespace BackendWorkerService.Quartz.Jobs
|
||||
dictionaryList.Add(dictionary);
|
||||
|
||||
}
|
||||
// 之前以為沒有唯一識別碼(uuid),故該table有設置一個以device_guid跟alarm_time的unique替代
|
||||
|
||||
var mergeSql = @"
|
||||
INSERT INTO emergency_event
|
||||
(emergency_event_guid, disaster, device_guid, building_tag, type, alarm_time)
|
||||
|
@ -42,11 +42,8 @@ namespace BackendWorkerService.Quartz.Jobs
|
||||
{
|
||||
try
|
||||
{
|
||||
var sqlObix = $@"SELECT system_value as Value, system_key as Name FROM variable WHERE deleted = 0 AND system_type = 'obixConfig'";
|
||||
|
||||
var variableObix = backgroundServiceRepository.GetAllAsync<KeyValue>(sqlObix).Result;
|
||||
string username = variableObix.Where(x => x.Name == "UserName").Select(x => x.Value).FirstOrDefault();
|
||||
string password = variableObix.Where(x => x.Name == "Password").Select(x => x.Value).FirstOrDefault();
|
||||
string username = "stanGG";
|
||||
string password = "St12345678";
|
||||
string encoded = Convert.ToBase64String(System.Text.Encoding.GetEncoding("ISO-8859-1").GetBytes(username + ":" + password));
|
||||
HttpWebRequest Postrequest = (HttpWebRequest)WebRequest.Create(url);
|
||||
Postrequest.Method = "POST";
|
||||
|
@ -61,10 +61,8 @@ namespace FrontendWebApi.ApiControllers
|
||||
|
||||
using (HttpClient client = new HttpClient())
|
||||
{
|
||||
var sqlObix = $@"SELECT system_value as Value, system_key as Name FROM variable WHERE deleted = 0 AND system_type = 'obixConfig'";
|
||||
var variableObix = frontendRepository.GetAllAsync<KeyValue>(sqlObix).Result;
|
||||
string username = variableObix.Where(x => x.Name == "UserName").Select(x => x.Value).FirstOrDefault();
|
||||
string password = variableObix.Where(x => x.Name == "Password").Select(x => x.Value).FirstOrDefault();
|
||||
string username = "stanGG";
|
||||
string password = "St12345678";
|
||||
string encoded = Convert.ToBase64String(System.Text.Encoding.GetEncoding("ISO-8859-1").GetBytes(username + ":" + password));
|
||||
|
||||
client.DefaultRequestHeaders.Add("Authorization", "Basic " + encoded);
|
||||
|
@ -359,22 +359,12 @@ namespace FrontendWebApi.ApiControllers
|
||||
var sub_system = await backendRepository.GetOneAsync<BuildMenuSql>(@$"select v.system_key subfull_name,me.* from building_menu me
|
||||
left join variable v on v.system_value = me.sub_system_tag and v.system_type = 'device_system_category_layer3' and v.deleted = 0
|
||||
where me.building_tag = '{get.building_tag}' and me.main_system_tag = '{get.main_system_tag}' and me.sub_system_tag = '{get.sub_system_tag}' order by me.priority");
|
||||
get.sub_system_tag = get.sub_system_tag == "P" ? $"'{get.sub_system_tag}','B'" : $"'{get.sub_system_tag}'"; // 巨蛋緊急壓扣(P)跟閃光喇吧被視為同一類
|
||||
|
||||
List<Floor> Floors = new List<Floor>();
|
||||
var floorsql = await backendRepository.GetAllAsync<Floorsql>($@"
|
||||
select * from (select *,
|
||||
CASE
|
||||
WHEN ssf.sub_system_tag IN ({get.sub_system_tag}) THEN 'P_B' -- 將 'P' 和 'B' 合併為一個類
|
||||
ELSE ssf.sub_system_tag -- 其他保持原樣
|
||||
END AS merged_sub_system_tag
|
||||
from sub_system_floor ssf where ssf.deleted = 0 and ssf.status = 0
|
||||
and ssf.building_tag = '{get.building_tag}'
|
||||
and ssf.main_system_tag = '{get.main_system_tag}'
|
||||
and ssf.sub_system_tag in ({get.sub_system_tag})
|
||||
and ssf.is_link = 1) a
|
||||
select * from (select * from sub_system_floor ssf where ssf.deleted = 0 and ssf.status = 0 and ssf.building_tag = '{get.building_tag}' and ssf.main_system_tag = '{get.main_system_tag}' and ssf.sub_system_tag = '{get.sub_system_tag}' and ssf.is_link = 1) a
|
||||
left join floor on floor.full_name = a.floor_tag and a.building_tag = floor.building_tag
|
||||
where floor.deleted = 0
|
||||
GROUP BY a.floor_tag, a.building_tag, a.merged_sub_system_tag
|
||||
order by floor.priority");
|
||||
Sub_system sub_System = new Sub_system()
|
||||
{
|
||||
@ -412,7 +402,6 @@ namespace FrontendWebApi.ApiControllers
|
||||
catch (Exception exception)
|
||||
{
|
||||
apiResult.Code = "9999";
|
||||
apiResult.Msg = "9999";
|
||||
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
|
||||
return Ok(apiResult);
|
||||
}
|
||||
|
@ -319,7 +319,6 @@ namespace FrontendWebApi.ApiControllers
|
||||
|
||||
try
|
||||
{
|
||||
input.EnableLimit = false; // CSV關閉5W筆限制
|
||||
var apiData = await GetHistoryRealTime(input);
|
||||
if (apiData.Value == null)
|
||||
{
|
||||
@ -1395,7 +1394,6 @@ namespace FrontendWebApi.ApiControllers
|
||||
ApiResult<List<HistoryRawData>> apiResult = new ApiResult<List<HistoryRawData>>(jwt_str);
|
||||
apiResult.Data = new List<HistoryRawData>();
|
||||
List<string> noDataDevice = new List<string>();
|
||||
|
||||
if (!jwtlife)
|
||||
{
|
||||
apiResult.Code = "5000";
|
||||
@ -1441,8 +1439,6 @@ namespace FrontendWebApi.ApiControllers
|
||||
int totalRecordCount = 0;
|
||||
|
||||
// 先計算總記錄數
|
||||
if (input.EnableLimit)
|
||||
{
|
||||
foreach (var hi in input.HistoryItems)
|
||||
{
|
||||
var device_number = hi.Device_number_point.Split(":")[0];
|
||||
@ -1467,6 +1463,9 @@ namespace FrontendWebApi.ApiControllers
|
||||
return apiResult;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
noDataDevice.Add(hi.Device_number_point);
|
||||
}
|
||||
}
|
||||
// 正式撈取資料
|
||||
@ -1474,7 +1473,7 @@ namespace FrontendWebApi.ApiControllers
|
||||
{
|
||||
var device_number = hi.Device_number_point.Split(":")[0];
|
||||
var point = hi.Device_number_point.Split(":")[1];
|
||||
var stationName = await backendRepository.GetOneAsync<string>($"select distinct parent_path from import_niagara_item_history where device_number = '{device_number}' limit 1");
|
||||
var stationName = await backendRepository.GetOneAsync<string>($"select distinct parent_path from import_niagara_item_history where device_building_tag = '{device_number.Split('_')[0]}' limit 1");
|
||||
var tableName = await backgroundServiceMsSqlRepository.GetOneAsync<string>($"select table_name from INFORMATION_SCHEMA.TABLES where table_name like '%{stationName}_{device_number}_{point}%'");
|
||||
if (!string.IsNullOrEmpty(tableName))
|
||||
{
|
||||
@ -1486,18 +1485,31 @@ namespace FrontendWebApi.ApiControllers
|
||||
//valueFacets = "range=E:{$u5176$u4ed6$u72c0$u614b=1,$u6b63$u5e38=2,$u4f4e$u96fb$u4f4d=3,$u8017$u76e1=4,$u672a$u9023$u63a5=5,$u7570$u5e38=6}";
|
||||
|
||||
// 檢查 valueFacets 是否包含 "range=E"
|
||||
string valueDisplaySql = string.Empty;
|
||||
// 直接給千分位數值會讓前台套件顯示有問題,故頁面千分位顯示由前端處理,CSV千分位後端處理
|
||||
string DisplaySql = input.EnableLimit ? "ROUND(value, 2) AS Value" : " FORMAT(ROUND(value, 2), 'N2') AS Value";
|
||||
|
||||
if (valueFacets != null)
|
||||
string valueDisplaySql;
|
||||
if (valueFacets != null && valueFacets.Contains("range=E"))
|
||||
{
|
||||
// 提取 "range=E:" 之後的部分
|
||||
string rangePart = valueFacets.Substring(valueFacets.IndexOf("range=E:") + "range=E:".Length);
|
||||
|
||||
// 去除開頭和結尾的大括號
|
||||
rangePart = rangePart.Trim('{', '}');
|
||||
|
||||
// 分割各個條目
|
||||
var entries = rangePart.Split(',');
|
||||
|
||||
// 存儲匹配條目的列表
|
||||
var caseWhenStatements = new List<string>();
|
||||
|
||||
// 轉換 Unicode 序列為中文字符的函數
|
||||
string ConvertUnicodeToChinese(string unicodeSequence)
|
||||
foreach (var entry in entries)
|
||||
{
|
||||
// 分割 Unicode 序列和數字
|
||||
var parts = entry.Split('=');
|
||||
if (parts.Length == 2)
|
||||
{
|
||||
string unicodeSequence = parts[0];
|
||||
int correspondingValue = int.Parse(parts[1]);
|
||||
|
||||
// 轉換 Unicode 序列為中文字符
|
||||
var chineseCharacters = new StringBuilder();
|
||||
var unicodeParts = unicodeSequence.Split("$u");
|
||||
foreach (var unicodePart in unicodeParts)
|
||||
@ -1508,70 +1520,21 @@ namespace FrontendWebApi.ApiControllers
|
||||
chineseCharacters.Append(char.ConvertFromUtf32(unicodeValue));
|
||||
}
|
||||
}
|
||||
return chineseCharacters.ToString();
|
||||
}
|
||||
|
||||
// 處理 range=E 的部分
|
||||
if (valueFacets.Contains("range=E"))
|
||||
{
|
||||
// 提取 "range=E:" 之後的部分
|
||||
string rangePart = valueFacets.Substring(valueFacets.IndexOf("range=E:") + "range=E:".Length);
|
||||
rangePart = rangePart.Trim('{', '}'); // 去除大括號
|
||||
var entries = rangePart.Split(',');
|
||||
|
||||
foreach (var entry in entries)
|
||||
{
|
||||
var parts = entry.Split('=');
|
||||
if (parts.Length == 2)
|
||||
{
|
||||
string unicodeSequence = parts[0];
|
||||
int correspondingValue = int.Parse(parts[1]);
|
||||
|
||||
// 轉換 Unicode 為中文
|
||||
string chineseCharacters = ConvertUnicodeToChinese(unicodeSequence);
|
||||
|
||||
// 添加 Case When 語句
|
||||
caseWhenStatements.Add($"when value = {correspondingValue} then '{chineseCharacters}'");
|
||||
}
|
||||
}
|
||||
|
||||
valueDisplaySql = $"Case {string.Join(" ", caseWhenStatements)} else 'Unknow' End as Value";
|
||||
}
|
||||
// 處理 trueText 和 falseText 的部分
|
||||
else if (valueFacets.Contains("trueText=s:") && valueFacets.Contains("falseText=s:"))
|
||||
{
|
||||
// 提取 trueText 和 falseText 的部分
|
||||
string trueTextPart = valueFacets.Substring(valueFacets.IndexOf("trueText=s:") + "trueText=s:".Length);
|
||||
trueTextPart = trueTextPart.Split('|')[0]; // 只保留 trueText 的部分
|
||||
|
||||
string falseTextPart = valueFacets.Substring(valueFacets.IndexOf("falseText=s:") + "falseText=s:".Length);
|
||||
falseTextPart = falseTextPart.Split('|')[0]; // 只保留 falseText 的部分
|
||||
|
||||
// 如果不包含 $u,就直接使用這些字串
|
||||
if (trueTextPart.Contains("$u"))
|
||||
{
|
||||
trueTextPart = ConvertUnicodeToChinese(trueTextPart);
|
||||
}
|
||||
|
||||
if (falseTextPart.Contains("$u"))
|
||||
{
|
||||
falseTextPart = ConvertUnicodeToChinese(falseTextPart);
|
||||
}
|
||||
|
||||
// 添加 Case When 語句
|
||||
caseWhenStatements.Add($"when value = 1 then '{trueTextPart}'");
|
||||
caseWhenStatements.Add($"when value = 0 then '{falseTextPart}'");
|
||||
|
||||
// 最後的 SQL 語句
|
||||
valueDisplaySql = $"Case {string.Join(" ", caseWhenStatements)} else 'Unknow' End as Value";
|
||||
}
|
||||
else
|
||||
{
|
||||
// 使用原始的顯示方式
|
||||
// 如果不包含 range=E,使用原始的顯示方式
|
||||
valueDisplaySql = valueType.Equals("bit")
|
||||
? "Case when value = 1 then 'true' when value = 0 then 'false' else 'Unknow' End as Value"
|
||||
: DisplaySql;
|
||||
}
|
||||
|
||||
: "round(value, 2) as Value";
|
||||
}
|
||||
|
||||
|
||||
@ -1597,7 +1560,7 @@ namespace FrontendWebApi.ApiControllers
|
||||
|
||||
apiResult.Code = "0000";
|
||||
apiResult.Msg = @$"DB無資料的設備:{string.Join(".", noDataDevice)}";
|
||||
apiResult.Data = apiResult.Data.OrderBy(x => x.Device_number).ThenBy(x => x.Points).ThenByDescending(x => x.Timestamp).ToList();
|
||||
apiResult.Data = apiResult.Data.OrderBy(x => x.Device_number).ThenByDescending(x => x.Timestamp).ToList();
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
|
@ -170,7 +170,7 @@ namespace FrontendWebApi.ApiControllers
|
||||
stylein12.WrapText = true;
|
||||
#endregion
|
||||
|
||||
var sheet = workbook.CreateSheet(input.exportOpeTypeName);
|
||||
var sheet = workbook.CreateSheet("電表報表");
|
||||
int RowPosition = 0;
|
||||
if (result.Count > 0)
|
||||
{
|
||||
@ -202,7 +202,7 @@ namespace FrontendWebApi.ApiControllers
|
||||
|
||||
cell = row.CreateCell(i++);
|
||||
cell.SetCellValue("內容");
|
||||
cell.CellStyle = styleLine12;
|
||||
cell.CellStyle = stylein12;
|
||||
cell = row.CreateCell(i++);
|
||||
cell.SetCellValue("紀錄時間");
|
||||
cell.CellStyle = styleLine12;
|
||||
|
@ -6,7 +6,6 @@ using Newtonsoft.Json;
|
||||
using NPOI.SS.UserModel;
|
||||
using NPOI.XSSF.UserModel;
|
||||
using Repository.BackendRepository.Implement;
|
||||
using Repository.BackendRepository.Interface;
|
||||
using Repository.FrontendRepository.Interface;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -83,10 +82,8 @@ namespace FrontendWebApi.ApiControllers
|
||||
using (HttpClient client = new HttpClient())
|
||||
{
|
||||
apiUrl = Path.Combine(baseApiUrl, "obix/config/", apiUrl);
|
||||
var sqlObix = $@"SELECT system_value as Value, system_key as Name FROM variable WHERE deleted = 0 AND system_type = 'obixConfig'";
|
||||
var variableObix = frontendRepository.GetAllAsync<KeyValue>(sqlObix).Result;
|
||||
string username = variableObix.Where(x => x.Name == "UserName").Select(x => x.Value).FirstOrDefault();
|
||||
string password = variableObix.Where(x => x.Name == "Password").Select(x => x.Value).FirstOrDefault();
|
||||
string username = "stanGG";
|
||||
string password = "St12345678";
|
||||
string encoded = Convert.ToBase64String(System.Text.Encoding.GetEncoding("ISO-8859-1").GetBytes(username + ":" + password));
|
||||
|
||||
client.DefaultRequestHeaders.Add("Authorization", "Basic " + encoded);
|
||||
@ -168,10 +165,8 @@ namespace FrontendWebApi.ApiControllers
|
||||
using (HttpClient client = new HttpClient())
|
||||
{
|
||||
apiUrl = Path.Combine(baseApiUrl, "obix/config/", apiUrl);
|
||||
var sqlObix = $@"SELECT system_value as Value, system_key as Name FROM variable WHERE deleted = 0 AND system_type = 'obixConfig'";
|
||||
var variableObix = frontendRepository.GetAllAsync<KeyValue>(sqlObix).Result;
|
||||
string username = variableObix.Where(x => x.Name == "UserName").Select(x => x.Value).FirstOrDefault();
|
||||
string password = variableObix.Where(x => x.Name == "Password").Select(x => x.Value).FirstOrDefault();
|
||||
string username = "stanGG";
|
||||
string password = "St12345678";
|
||||
string encoded = Convert.ToBase64String(System.Text.Encoding.GetEncoding("ISO-8859-1").GetBytes(username + ":" + password));
|
||||
|
||||
client.DefaultRequestHeaders.Add("Authorization", "Basic " + encoded);
|
||||
|
@ -197,7 +197,6 @@ namespace FrontendWebApi.Models
|
||||
public string point_name { get; set; }
|
||||
public string points { get; set; }
|
||||
public byte points_is_bool { get; set; }
|
||||
public int is_RTSP { get; set; } // 巨蛋監視器控制項
|
||||
public List<DeviceNode> Device_nodes { get; set; }
|
||||
public List<DeviceItem> deviceItems { get; set; }
|
||||
}
|
||||
|
@ -259,7 +259,6 @@ namespace FrontendWebApi.Models
|
||||
{
|
||||
public string Start_timestamp { get; set; }
|
||||
public string End_timestamp { get; set; }
|
||||
public bool EnableLimit { get; set; } = true; // 控制是否需要限制查詢筆數
|
||||
public List<HistoryItem> HistoryItems { get; set; }
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@
|
||||
<span aria-hidden="true"><i class="fal fa-times"></i></span>
|
||||
</button>*@
|
||||
<div class="position-absolute pos-right mr-sm-3 mt-sm-3 z-index-space">
|
||||
<button type="button" class="btn btn-danger waves-effect waves-themed mr-2" id="Tcp" onclick="SendMessageAsync('D002')">取消上牆</button>
|
||||
@*<button type="button" class="btn btn-danger waves-effect waves-themed mr-2" id="Tcp" onclick="SendMessageAsync('D002')">取消上牆</button>*@
|
||||
<button type="button" class="btn btn-danger waves-effect waves-themed" id="closemodal" onclick="Closemodal()">關閉流程</button>
|
||||
</div>
|
||||
<div class="modal-body bg-white">
|
||||
@ -755,7 +755,7 @@
|
||||
selected_device_time = $(this).parents('tr').attr('data-time');
|
||||
|
||||
OnSimulationExercise(selected_device_guid, selected_device_disaster, 0, selected_device_time);
|
||||
SendMessageAsync("D001");
|
||||
// SendMessageAsync("D001");
|
||||
});
|
||||
//#endregion
|
||||
|
||||
@ -1952,7 +1952,7 @@
|
||||
CloseVerify = true;
|
||||
$('#emergency-verify-modal').modal('hide');
|
||||
$('#SimulationExercisemodal').modal('hide');
|
||||
SendMessageAsync("D002");
|
||||
// SendMessageAsync("D002");
|
||||
UpdateRecordFinishTime()
|
||||
CloseVerify = false; // 每次關閉流程都要驗證一次
|
||||
} else {
|
||||
|
@ -122,7 +122,7 @@
|
||||
<span aria-hidden="true"><i class="fal fa-times"></i></span>
|
||||
</button>*@
|
||||
<div class="position-absolute pos-right mr-sm-3 mt-sm-3 z-index-space">
|
||||
<button type="button" class="btn btn-danger waves-effect waves-themed mr-2" id="Tcp" onclick="SendMessageAsync('D002')">取消上牆</button>
|
||||
@*<button type="button" class="btn btn-danger waves-effect waves-themed mr-2" id="Tcp" onclick="SendMessageAsync('D002')">取消上牆</button>*@
|
||||
<button type="button" class="btn btn-danger waves-effect waves-themed" id="closemodal" onclick="Closemodal()">關閉流程</button>
|
||||
</div>
|
||||
<div class="modal-body bg-white">
|
||||
@ -860,7 +860,7 @@
|
||||
SimulationExerciseGuid = selected_event_guid;
|
||||
|
||||
OnSimulationExercise(selected_event_guid, selected_device_disaster, 0);
|
||||
SendMessageAsync("D001");
|
||||
// SendMessageAsync("D001");
|
||||
});
|
||||
//#endregion
|
||||
//#region 模擬演練 / SOP 開啟畫面
|
||||
@ -1385,7 +1385,7 @@
|
||||
CloseVerify = true;
|
||||
$('#emergency-verify-modal').modal('hide');
|
||||
$('#SimulationExercisemodal').modal('hide');
|
||||
SendMessageAsync("D002");
|
||||
// SendMessageAsync("D002");
|
||||
UpdateRecordFinishTime(function () {
|
||||
EmergencyEventTable.ajax.reload();
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user