Merge branch 'master' of https://gitea.mjm-staging.developers-homelab.net/BIMS/BIMS
This commit is contained in:
commit
e986fa9305
@ -1662,7 +1662,7 @@ namespace Backend.Controllers
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string sWhere = "deleted = 0 AND device_name_tag = @Sub_system_tag and device_building_tag = @device_building_tag";
|
string sWhere = "deleted = 0 AND device_name_tag = @Sub_system_tag and device_building_tag = @device_building_tag and is_link = 1 and is_controll = 1";
|
||||||
|
|
||||||
object param = new { Sub_system_tag = input.sub_system_tag, device_building_tag = input.building_tag };
|
object param = new { Sub_system_tag = input.sub_system_tag, device_building_tag = input.building_tag };
|
||||||
|
|
||||||
|
@ -501,26 +501,37 @@ namespace Backend.Controllers
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
var main_tag = await backendRepository.GetOneAsync<string>($@"SELECT system_value FROM variable WHERE id = @id", new { id = device_Item.device_system_tag });
|
||||||
|
var sub_tag = await backendRepository.GetOneAsync<string>($@"SELECT system_value FROM variable WHERE id = @id", new { id = device_Item.device_name_tag });
|
||||||
//檢查是否有未刪除的區域選單
|
//檢查是否有未刪除的區域選單
|
||||||
if(device_Item.is_show_riserDiagram == 1)
|
if (device_Item.is_show_riserDiagram == 1)
|
||||||
{
|
{
|
||||||
var sql_show_riserDiagram = $@"SELECT * FROM device_item di
|
var sql_show_riserDiagram = $@"SELECT di.id FROM device_item di
|
||||||
WHERE di.id = @id AND di.deleted = 0 AND is_show_riserDiagram = 1";
|
WHERE di.id != @id AND di.deleted = 0 AND is_show_riserDiagram = 1 and device_system_tag = @device_system_tag
|
||||||
|
and device_name_tag = @device_name_tag";
|
||||||
|
|
||||||
var is_show_riserDiagram = await backendRepository.GetAllAsync<string>(sql_show_riserDiagram, new { id = device_Item.id });
|
var deviceItemId = await backendRepository.GetAllAsync<int>(sql_show_riserDiagram,
|
||||||
|
new { id = device_Item.id, device_system_tag = main_tag, device_name_tag = sub_tag });
|
||||||
|
|
||||||
if (is_show_riserDiagram.Count() > 0)
|
if (deviceItemId.Count() > 0)
|
||||||
{
|
{
|
||||||
apiResult.Code = "9998";
|
foreach (var id in deviceItemId)
|
||||||
apiResult.Msg = "請先取消已選擇顯示於昇位圖點位。";
|
{
|
||||||
return apiResult;
|
Dictionary<string, object> Device_itemDic = new Dictionary<string, object>()
|
||||||
|
{
|
||||||
|
{ "@is_show_riserDiagram", false},
|
||||||
|
{ "@updated_by", myUserInfo.Userinfo_guid},
|
||||||
|
{ "@updated_at", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")},
|
||||||
|
};
|
||||||
|
|
||||||
|
await backendRepository.UpdateOneByCustomTable(Device_itemDic, "device_item", "id='" + id + "'");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device_Item.id == 0)
|
if (device_Item.id == 0)
|
||||||
{
|
{
|
||||||
var main_tag = await backendRepository.GetOneAsync<string>($@"SELECT system_value FROM variable WHERE id = @id", new { id = device_Item.device_system_tag });
|
|
||||||
var sub_tag = await backendRepository.GetOneAsync<string>($@"SELECT system_value FROM variable WHERE id = @id", new { id = device_Item.device_name_tag });
|
|
||||||
//新增
|
//新增
|
||||||
Dictionary<string, object> Device_itemDic = new Dictionary<string, object>()
|
Dictionary<string, object> Device_itemDic = new Dictionary<string, object>()
|
||||||
{
|
{
|
||||||
@ -586,7 +597,7 @@ namespace Backend.Controllers
|
|||||||
FROM device_item di
|
FROM device_item di
|
||||||
JOIN variable sv ON di.device_name_tag = sv.system_value
|
JOIN variable sv ON di.device_name_tag = sv.system_value
|
||||||
JOIN variable mv ON sv.system_parent_id = mv.id AND di.device_system_tag = mv.system_value
|
JOIN variable mv ON sv.system_parent_id = mv.id AND di.device_system_tag = mv.system_value
|
||||||
WHERE sv.id = @id AND di.deleted = @Deleted and di.device_building_tag = @building_tag";
|
WHERE sv.id = @id AND di.deleted = @Deleted and di.device_building_tag = @building_tag and di.is_link = 1";
|
||||||
|
|
||||||
object param = new { Deleted = 0, id = id, building_tag = building_tag.Split("/")[1] };
|
object param = new { Deleted = 0, id = id, building_tag = building_tag.Split("/")[1] };
|
||||||
|
|
||||||
|
@ -219,6 +219,7 @@
|
|||||||
pageAct.selAllSysSub = false;
|
pageAct.selAllSysSub = false;
|
||||||
first = true;
|
first = true;
|
||||||
let dataAlarm = [];
|
let dataAlarm = [];
|
||||||
|
var historyTable = null;
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
initDropzone();
|
initDropzone();
|
||||||
@ -651,9 +652,12 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
else {
|
||||||
|
$('#alertTable').DataTable().clear().draw();
|
||||||
$(loadEle).Loading("close");
|
$(loadEle).Loading("close");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function stackData(res) {
|
function stackData(res) {
|
||||||
res.data.forEach(v => {
|
res.data.forEach(v => {
|
||||||
@ -663,7 +667,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function callBackFromAllDeviceAlert(res) {
|
function callBackFromAllDeviceAlert(res) {
|
||||||
refTable(res.data);
|
AlertList(res.data);
|
||||||
|
|
||||||
if (historyTable != null) {
|
if (historyTable != null) {
|
||||||
let t = $('#alertTable').dataTable();
|
let t = $('#alertTable').dataTable();
|
||||||
|
|
||||||
@ -674,7 +679,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function callBackFromOneDeviceAlert(res) {
|
function callBackFromOneDeviceAlert(res) {
|
||||||
refTable(res);
|
AlertList(res);
|
||||||
|
|
||||||
if (historyTable != null) {
|
if (historyTable != null) {
|
||||||
let t = $('#alertTable').dataTable();
|
let t = $('#alertTable').dataTable();
|
||||||
@ -686,14 +691,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function refTable(data) {
|
function refTable(data) {
|
||||||
console.log(data)
|
|
||||||
let tag = "#alertTable";
|
let tag = "#alertTable";
|
||||||
|
|
||||||
$.each(data, function (i, v) {
|
|
||||||
// console.log(v.uuid.$val, v.uuid)
|
|
||||||
v.formId = AlertList(v.uuid.$val || v.uuid);
|
|
||||||
});
|
|
||||||
|
|
||||||
let column_defs = [
|
let column_defs = [
|
||||||
{ "targets": [0], "width": "5%", "sortable": true },
|
{ "targets": [0], "width": "5%", "sortable": true },
|
||||||
{ "targets": [1], "width": "5%", "sortable": true },
|
{ "targets": [1], "width": "5%", "sortable": true },
|
||||||
@ -771,19 +770,25 @@
|
|||||||
];
|
];
|
||||||
|
|
||||||
historyTable = new YourTeam.JqDataTables.getTableByStatic(tag, data, columns, column_defs, null, null, null, null, "tpi");
|
historyTable = new YourTeam.JqDataTables.getTableByStatic(tag, data, columns, column_defs, null, null, null, null, "tpi");
|
||||||
|
$(loadEle).Loading("close");
|
||||||
}
|
}
|
||||||
|
|
||||||
function AlertList(errCode) {
|
function AlertList(data) {
|
||||||
objSendData.Data = { uuid: errCode };
|
objSendData.Data = [];
|
||||||
let a = null
|
$.each(data, function (i, v) {
|
||||||
|
objSendData.Data.push({ uuid: v.uuid.$val || v.uuid })
|
||||||
|
});
|
||||||
|
|
||||||
url = baseApiUrl + "/Alert/AlertList";
|
url = baseApiUrl + "/Alert/AlertList";
|
||||||
ytAjax = new YourTeam.Ajax(url, objSendData, function (rel) {
|
ytAjax = new YourTeam.Ajax(url, objSendData, function (rel) {
|
||||||
if (rel.code == "0000")
|
if (rel.code == "0000") {
|
||||||
a = rel.data;
|
$.each(rel.data, function (i, v) {
|
||||||
// console.log(rel)
|
let index = data.findIndex(x => (x.uuid.$val || x.uuid) === v.uuid);
|
||||||
|
data[index].formId = v.formId;
|
||||||
|
});
|
||||||
|
refTable(data)
|
||||||
|
}
|
||||||
}, null, "POST").send();
|
}, null, "POST").send();
|
||||||
|
|
||||||
return a;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function selDevice() {
|
function selDevice() {
|
||||||
|
@ -10,6 +10,8 @@ using System.IO;
|
|||||||
using System.Data.SqlTypes;
|
using System.Data.SqlTypes;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using NPOI.HSSF.Record.Chart;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace FrontendWebApi.ApiControllers
|
namespace FrontendWebApi.ApiControllers
|
||||||
{
|
{
|
||||||
@ -169,13 +171,19 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<ApiResult<string>> AlertList([FromBody] FindFormId alerts)
|
public async Task<ApiResult<List<FindFormId>>> AlertList([FromBody] List<FindFormId> alerts)
|
||||||
{
|
{
|
||||||
ApiResult<string> apiResult = new ApiResult<string>();
|
ApiResult<List<FindFormId>> apiResult = new ApiResult<List<FindFormId>>();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var sqlString = $@"select formId from operation_record where error_code = @error_code and deleted = 0 limit 1";
|
var formId = new List<FindFormId>();
|
||||||
var formId = await backendRepository.GetOneAsync<string>(sqlString, new { @error_code = alerts.uuid });
|
foreach(var fi in alerts)
|
||||||
|
{
|
||||||
|
var sqlString = $@"select error_code uuid, formId from operation_record where error_code = @error_code and deleted = 0 limit 1";
|
||||||
|
var data = await backendRepository.GetOneAsync<FindFormId>(sqlString, new { @error_code = fi.uuid });
|
||||||
|
if (data != null)
|
||||||
|
formId.Add(data);
|
||||||
|
}
|
||||||
|
|
||||||
apiResult.Code = "0000";
|
apiResult.Code = "0000";
|
||||||
apiResult.Data = formId;
|
apiResult.Data = formId;
|
||||||
|
@ -33,6 +33,7 @@ namespace FrontendWebApi.Models
|
|||||||
public class FindFormId
|
public class FindFormId
|
||||||
{
|
{
|
||||||
public string uuid { get; set; }
|
public string uuid { get; set; }
|
||||||
|
public string formId { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user