衝突合併 | 文件格式化調整

This commit is contained in:
dev01 2022-11-21 18:48:50 +08:00
commit dfb36f08f3
5 changed files with 33 additions and 13 deletions

Binary file not shown.

View File

@ -26,13 +26,17 @@ function getAlarmByBaja(startDate_millisecond, endDate_millisecond, isRecover, i
_sourceTmp = (record.get('alarmData').get('sourceName')).toString().split('_'); _sourceTmp = (record.get('alarmData').get('sourceName')).toString().split('_');
_bfName = _sourceTmp[1] + "-" + _sourceTmp[4]; _bfName = _sourceTmp[1] + "-" + _sourceTmp[4];
_sourceName = _sourceTmp[7] + "-" + _sourceTmp[8]; _sourceName = _sourceTmp[7] + "-" + _sourceTmp[8];
_ss += ', "' + _index + '": {"buildingFloorName_zh":"' + _bfName + '", "uuid":"' + record.get('uuid') + '", "timestamp":"' + record.get('timestamp') + '", "alarmClass":"' + record.get('alarmClass') + '", "sourceName_zh":"' + _sourceName + '", "msgText":"' + record.get('alarmData').get('msgText') + '", "ackState":"' + record.get('ackState') + '", "normalTime":"' + record.get('normalTime') + '"}';
if (_index == 0)
_ss += '{"buildingFloorName_zh":"' + _bfName + '", "uuid":"' + record.get('uuid') + '", "timestamp":"' + record.get('timestamp') + '", "alarmClass":"' + record.get('alarmClass') + '", "sourceName_zh":"' + _sourceName + '", "msgText":"' + record.get('alarmData').get('msgText') + '", "ackState":"' + record.get('ackState') + '", "normalTime":"' + record.get('normalTime') + '"}';
else
_ss += ',{"buildingFloorName_zh":"' + _bfName + '", "uuid":"' + record.get('uuid') + '", "timestamp":"' + record.get('timestamp') + '", "alarmClass":"' + record.get('alarmClass') + '", "sourceName_zh":"' + _sourceName + '", "msgText":"' + record.get('alarmData').get('msgText') + '", "ackState":"' + record.get('ackState') + '", "normalTime":"' + record.get('normalTime') + '"}';
_index++; _index++;
}, },
after: function () { after: function () {
_result += '{' + '"count": ' + _index; _result += '{' + '"count": ' + _index + ', "data":[';
_result += _ss; _result += _ss;
_result += '}'; _result += ']}';
if (typeof callback === 'function') { if (typeof callback === 'function') {
callback(_result); callback(_result);
} }
@ -64,8 +68,7 @@ function getOneDeviceAlarmTop10ByBaja(devicePath, callback) {
_index++; _index++;
}, },
after: function () { after: function () {
_result += '{' + '"count": ' + _index +', data:['; _result += '{' + '"count": ' + _index + ', "data":[';
_result += _ss + ']'; _result += _ss + ']';
_result += '}'; _result += '}';
if (typeof callback === 'function') { if (typeof callback === 'function') {
@ -92,13 +95,16 @@ function getOneSystemAlarmStateByBaja(systemPath, callback) {
.then(function (table) { .then(function (table) {
return table.cursor({ return table.cursor({
each: function (record) { each: function (record) {
_ss += ', "' + _index + '": {"uuid":"' + record.get('uuid') + '", "sourceName":"' + record.get('alarmData').get('sourceName') + '", "sourceState":"' + record.get('sourceState') + '"}'; if (_index == 0)
_ss += '{"uuid":"' + record.get('uuid') + '", "sourceName":"' + record.get('alarmData').get('sourceName') + '", "sourceState":"' + record.get('sourceState') + '"}';
else
_ss += ',{"uuid":"' + record.get('uuid') + '", "sourceName":"' + record.get('alarmData').get('sourceName') + '", "sourceState":"' + record.get('sourceState') + '"}';
_index++; _index++;
}, },
after: function () { after: function () {
_result += '{' + '"count": ' + _index; _result += '{' + '"count": ' + _index + ', "data":[';
_result += _ss; _result += _ss;
_result += '}'; _result += ']}';
if (typeof callback === 'function') { if (typeof callback === 'function') {
callback(_result); callback(_result);
} }

View File

@ -18,13 +18,16 @@ function getHistoryDataByBaja(devicePath, startDate_millisecond, endDate_millise
.then(function (table) { .then(function (table) {
return table.cursor({ return table.cursor({
each: function (record) { each: function (record) {
_ss += ', "' + _index + '": {"deviceName":"' + deviceName + '", "value":' + record.get('value') + ', "timestamp":"' + record.get('timestamp') + '"}'; if (_index == 0)
_ss += '{"deviceName":"' + deviceName + '", "value":' + record.get('value') + ', "timestamp":"' + record.get('timestamp') + '"}';
else
_ss += ',{"deviceName":"' + deviceName + '", "value":' + record.get('value') + ', "timestamp":"' + record.get('timestamp') + '"}';
_index++; _index++;
}, },
after: function () { after: function () {
_result += '{' + '"count": ' + _index; _result += '{' + '"count": ' + _index + ', "data":[';
_result += _ss; _result += _ss;
_result += '}'; _result += ']}';
if (typeof callback === 'function') { if (typeof callback === 'function') {
callback(_result); callback(_result);
} }

View File

@ -61,13 +61,16 @@ namespace FrontendWebApi.ApiControllers
{ {
var dbsub = await frontendRepository.GetAllAsync<HistoryDBMainSub>( var dbsub = await frontendRepository.GetAllAsync<HistoryDBMainSub>(
@$"select distinct v1.system_key main_name, v1.system_value main_system_tag, v2.system_key sub_name, v2.system_value sub_system_tag, v1.system_priority, v2.system_priority, @$"select distinct v1.system_key main_name, v1.system_value main_system_tag, v2.system_key sub_name, v2.system_value sub_system_tag, v1.system_priority, v2.system_priority,
dk.device_normal_color, dk.device_close_color, dk.device_error_color dk.device_normal_color, dk.device_close_color, dk.device_error_color,
di.full_name as device_item_name, di.points as device_item_points, di.unit as device_item_unit, di.is_show_riserDiagram as device_item_is_show_riserDiagram,
di.is_controll as device_item_is_controll, di.is_bool as device_item_is_bool, di.is_link as device_item_is_link
from role_auth a from role_auth a
join auth_page b on a.AuthCode = b.AuthCode join auth_page b on a.AuthCode = b.AuthCode
join userinfo c on c.role_guid = a.role_guid join userinfo c on c.role_guid = a.role_guid
join variable v2 on b.ShowView = v2.id and v2.system_type = @sub_system_type join variable v2 on b.ShowView = v2.id and v2.system_type = @sub_system_type
join variable v1 on v1.id = v2.system_parent_id and v1.system_type = @main_system_type join variable v1 on v1.id = v2.system_parent_id and v1.system_type = @main_system_type
left join device_kind dk on v1.system_value = dk.device_system_tag and v2.system_value = dk.device_name_tag and dk.device_building_tag = @building_tag left join device_kind dk on v1.system_value = dk.device_system_tag and v2.system_value = dk.device_name_tag and dk.device_building_tag = @building_tag
left join device_item di on v2.system_value = di.device_name_tag and v1.system_value = di.device_system_tag and di.deleted = 0
where c.account = @account where c.account = @account
order by v1.system_priority, v2.system_priority", new { @account = myUser.account, @sub_system_type = sub_system_type, @main_system_type = main_system_type, @building_tag = fd.building_tag }); order by v1.system_priority, v2.system_priority", new { @account = myUser.account, @sub_system_type = sub_system_type, @main_system_type = main_system_type, @building_tag = fd.building_tag });
var mains = dbsub.GroupBy(a => a.main_system_tag).ToList(); var mains = dbsub.GroupBy(a => a.main_system_tag).ToList();

View File

@ -62,6 +62,14 @@ namespace FrontendWebApi.Models
public string device_normal_color { get; set; } public string device_normal_color { get; set; }
public string device_close_color { get; set; } public string device_close_color { get; set; }
public string device_error_color { get; set; } public string device_error_color { get; set; }
public string device_item_name { get; set; }
public string device_item_points { get; set; }
public string device_item_unit { get; set; }
public byte device_item_is_show { get; set; }
public byte device_item_is_show_riserDiagram { get; set; }
public byte device_item_is_controll { get; set; }
public byte device_item_is_bool { get; set; }
public byte device_item_is_link { get; set; }
} }
public class BuildingFloorRawData public class BuildingFloorRawData