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