This commit is contained in:
dev01 2022-10-19 09:41:09 +08:00
commit 6dfa28bf86

View File

@ -805,7 +805,7 @@ namespace Backend.Controllers
try
{
var rawDatas = await backendRepository.GetAllAsync<DeviceImportCheckTempRawData>("device_import_ckeck_temp", "is_correct = 1 ORDER BY device_building_tag, device_system_tag, device_floor_tag, device_name_tag");
var rawDatas = await backendRepository.GetAllAsync<DeviceImportCheckTempRawData>("import_niagara_tag", null, null, "device_building_tag, device_system_tag, device_floor_tag, device_name_tag");
var rawDatas_Group_Building_tag = rawDatas.GroupBy(x => x.Device_building_tag).ToList();
List<DeviceImportCheckTempFilter> tempFilters = new List<DeviceImportCheckTempFilter>();
@ -872,36 +872,33 @@ namespace Backend.Controllers
try
{
string sql = @"SELECT
di.device_building_tag,
di.device_system_tag,
di.device_floor_tag,
di.device_name_tag,
di.device_serial_tag,
di.device_number,
di.device_system_category_layer3,
STRING_AGG( ISNULL(v.system_value, ' '), ',') AS Device_disasters,
STRING_AGG( ISNULL(v.system_key, ' '), ',') AS Device_disaster_type_text
FROM
(SELECT
*
FROM device_import_ckeck_temp di
WHERE device_building_tag = @Device_building_tag
AND device_system_tag = @Device_system_tag
AND device_floor_tag = @Device_floor_tag
AND device_name_tag = @Device_name_tag
AND is_correct = 1
AND device_number NOT IN (SELECT d.device_number FROM device d WHERE d.deleted = 0)
) di
CROSS APPLY STRING_SPLIT(di.device_disaster, ',') dd
LEFT JOIN variable v ON v.system_type = 'disaster' AND v.system_value = dd.value
GROUP BY di.device_building_tag,
di.device_system_tag,
di.device_floor_tag,
di.device_name_tag,
di.device_serial_tag,
di.device_number,
di.device_system_category_layer3";
di.device_building_tag,
di.device_system_tag,
di.device_floor_tag,
di.device_last_name_tag as device_name_tag,
di.device_serial_tag,
0 as device_disaster,
di.niagara_tags as device_number
FROM
(
SELECT
*
FROM
import_niagara_tag intag
WHERE
device_building_tag = @Device_building_tag
AND device_system_tag = @Device_system_tag
AND device_floor_tag = @Device_floor_tag
AND device_name_tag = @Device_name_tag
AND convert(intag.niagara_tags, nchar) NOT IN ( SELECT convert(d.device_number, nchar) FROM device d WHERE d.deleted = 0 )
) di
GROUP BY
di.device_building_tag,
di.device_system_tag,
di.device_floor_tag,
di.device_last_name_tag,
di.device_serial_tag,
di.niagara_tags";
var deviceImports = await backendRepository.GetAllAsync<DeviceImportCheckTemp>(sql, post);