[後台] 新增刪除設備程序修正
This commit is contained in:
parent
8f54db2c24
commit
b6e5c470ee
@ -345,12 +345,14 @@ namespace Backend.Controllers
|
||||
var guid = Guid.NewGuid();
|
||||
var split = device.Device_number.Split('_');
|
||||
|
||||
var device_building_tag = !string.IsNullOrEmpty(split[0]) ? split[0] : "";
|
||||
var device_system_tag = !string.IsNullOrEmpty(split[1]) ? split[1] : "";
|
||||
var device_floor_tag = !string.IsNullOrEmpty(split[2]) ? split[2] : "";
|
||||
var device_name_tag = !string.IsNullOrEmpty(split[3]) ? split[3] : "";
|
||||
var device_serial_tag = !string.IsNullOrEmpty(split[4]) ? split[4] : "";
|
||||
string device_master = null;
|
||||
var device_area_tag = !string.IsNullOrEmpty(split[0]) ? split[0] : "";
|
||||
var device_building_tag = !string.IsNullOrEmpty(post.Building_tag) ? post.Building_tag : "";
|
||||
var device_system_tag = !string.IsNullOrEmpty(post.Main_system_tag) ? post.Main_system_tag : "";
|
||||
var device_name_tag = !string.IsNullOrEmpty(post.Sub_system_tag) ? post.Sub_system_tag : "";
|
||||
var device_floor_tag = !string.IsNullOrEmpty(post.Floor_tag) ? post.Floor_tag : "";
|
||||
var device_last_name = !string.IsNullOrEmpty(split[6]) ? split[6] : "";
|
||||
var device_serial_tag = !string.IsNullOrEmpty(split[7]) ? split[7] : "";
|
||||
string device_master = "NA";
|
||||
|
||||
//針對燈具加入master
|
||||
if (device.Device_system_category_layer3 == "L1" || device.Device_system_category_layer3 == "L2")
|
||||
@ -361,12 +363,13 @@ namespace Backend.Controllers
|
||||
Dictionary<string, object> deviceDic = new Dictionary<string, object>()
|
||||
{
|
||||
{ "@device_guid", guid},
|
||||
{ "@full_name", device_name_tag + device_serial_tag},
|
||||
{ "@device_area_tag", device_area_tag},
|
||||
{ "@device_building_tag", device_building_tag},
|
||||
{ "@device_system_tag", device_system_tag},
|
||||
{ "@device_floor_tag", device_floor_tag},
|
||||
{ "@device_name_tag", device_name_tag},
|
||||
{ "@device_serial_tag", device_serial_tag},
|
||||
{ "@device_last_name", device_last_name},
|
||||
{ "@device_master", device_master},
|
||||
{ "@device_number", device.Device_number},
|
||||
{ "@device_system_category_layer3", device.Device_system_category_layer3},
|
||||
@ -1255,9 +1258,9 @@ namespace Backend.Controllers
|
||||
private async Task ResetDeviceGroup()
|
||||
{
|
||||
//先刪除整個device_group
|
||||
var delete_group_sql = @"DROP TABLE IF EXISTS `device_group` ;
|
||||
var delete_group_sql = @"DROP TABLE IF EXISTS `device_group` ;
|
||||
CREATE TABLE `device_group` (
|
||||
`id` int(11) NOT NULL,
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`device_disaster` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '災類',
|
||||
`device_building_tag` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '設備東別guid',
|
||||
`device_floor_guid` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '設備樓層guid',
|
||||
@ -1274,13 +1277,14 @@ namespace Backend.Controllers
|
||||
INSERT INTO device_group (device_disaster, device_building_tag, device_floor_guid, device_system_category_layer2, device_system_category_layer3, device_amount)
|
||||
SELECT
|
||||
dd.device_system_value AS device_disaster,
|
||||
d.building_tag AS device_building_tag,
|
||||
d.floor_guid AS device_floor_guid,
|
||||
d.device_building_tag AS device_building_tag,
|
||||
f.floor_guid AS device_floor_guid,
|
||||
vv.device_system_category_layer2 AS device_system_category_layer2,
|
||||
d.device_system_category_layer3 AS device_system_category_layer3,
|
||||
count(*) AS device_amount
|
||||
FROM device d
|
||||
JOIN device_disaster dd ON d.device_guid = dd.device_guid
|
||||
JOIN floor f ON d.device_floor_tag = f.full_name
|
||||
JOIN (SELECT
|
||||
v.system_value AS device_system_category_layer3,
|
||||
v2.system_value AS device_system_category_layer2
|
||||
@ -1290,8 +1294,8 @@ namespace Backend.Controllers
|
||||
) vv ON d.device_system_category_layer3 = vv.device_system_category_layer3
|
||||
WHERE d.deleted = 0
|
||||
GROUP BY dd.device_system_value,
|
||||
d.building_tag,
|
||||
d.floor_guid,
|
||||
d.device_building_tag,
|
||||
f.floor_guid,
|
||||
vv.device_system_category_layer2,
|
||||
d.device_system_category_layer3";
|
||||
|
||||
@ -1317,7 +1321,7 @@ namespace Backend.Controllers
|
||||
|
||||
deviceGroupsDics.Add(deviceGroupDic);
|
||||
}
|
||||
await backendRepository.ManualInsertBackgroundServiceTask("", "", "device_group", "purge_all_insert", deviceGroupsDics);
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
@ -166,7 +166,7 @@
|
||||
<div class="row mb-3 align-items-center justify-content-start">
|
||||
<div class="col-12">
|
||||
<div class="row mb-2 align-items-center justify-content-start">
|
||||
<span class="col-1">區域</span>
|
||||
<span class="col-1">棟別</span>
|
||||
<div class="col-11 row">
|
||||
<div id="import-temp-building-tag-list" class="col-12">
|
||||
</div>
|
||||
@ -1545,7 +1545,6 @@
|
||||
return;
|
||||
}
|
||||
else {
|
||||
|
||||
device_kind_data = rel.data;
|
||||
|
||||
//取得單一設備基本資料
|
||||
@ -2571,7 +2570,7 @@
|
||||
//#region 變更新增設備基本資料modal的過濾條件
|
||||
function ChangeDeviceImportPanel(building_tag, system_tag = "", floor_tag = "") {
|
||||
if (building_tag == undefined && building_tag == null || building_tag == "") {
|
||||
toast_warning("請先選擇區域");
|
||||
toast_warning("請先選擇棟別");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2734,6 +2733,7 @@
|
||||
|
||||
|
||||
var formData = new FormData();
|
||||
formData.append("Building_tag", selectedBuilding_tag);
|
||||
formData.append("Main_system_tag", selectedMain_system_tag);
|
||||
formData.append("Sub_system_tag", selectedSub_system_tag);
|
||||
formData.append("Floor_tag", selectedFloor_tag);
|
||||
|
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 2.0 MiB |
Loading…
Reference in New Issue
Block a user