diff --git a/FrontendWebApi/ApiControllers/OperationController.cs b/FrontendWebApi/ApiControllers/OperationController.cs index f9fd2c1..25e0e1d 100644 --- a/FrontendWebApi/ApiControllers/OperationController.cs +++ b/FrontendWebApi/ApiControllers/OperationController.cs @@ -107,7 +107,7 @@ namespace FrontendWebApi.ApiControllers try { - var sqlString = @$"select device_area_tag from device where deleted = 0 and device_system_tag = @main_system_tag and device_name_tag = @sub_system_tag"; + var sqlString = @$"select system_value as device_area_tag, system_key as area_name from variable where system_type = 'area' and deleted = 0"; bl = await backendRepository.GetAllAsync(sqlString, new { @main_system_tag = b.main_system_tag, @sub_system_tag = b.sub_system_tag }); @@ -137,12 +137,11 @@ namespace FrontendWebApi.ApiControllers try { var sqlString = @$"select d.device_building_tag, b.full_name as building_name - from device d - join building b on d.device_building_tag = b.building_tag - where d.deleted = 0 and d.device_area_tag = @device_area_tag + from building b + where deleted = 0 and area_tag = @device_area_tag group by b.full_name, d.device_building_tag"; - bl = await backendRepository.GetAllAsync(sqlString, new { @device_area_tag = b.device_area_tag, @main_system_tag = b.main_system_tag, @sub_system_tag = b.sub_system_tag }); + bl = await backendRepository.GetAllAsync(sqlString, new { @device_area_tag = b.device_area_tag }); apiResult.Code = "0000"; apiResult.Data = bl; @@ -169,12 +168,12 @@ namespace FrontendWebApi.ApiControllers try { - var sqlString = @$"select d.device_floor_tag - from device d - where d.deleted = 0 and d.device_area_tag = @device_area_tag and d.device_building_tag = @device_building_tag and d.device_system_tag = @main_system_tag and d.device_name_tag = @sub_system_tag - group by d.device_floor_tag"; + var sqlString = @$"select full_name as device_floor_tag + from floor + where deleted = 0 and building_tag = @device_building_tag + group by full_name"; - bl = await backendRepository.GetAllAsync(sqlString, new { @device_area_tag = b.device_area_tag, @device_building_tag = b.device_building_tag, @main_system_tag = b.main_system_tag, @sub_system_tag = b.sub_system_tag }); + bl = await backendRepository.GetAllAsync(sqlString, new { @device_building_tag = b.device_building_tag }); apiResult.Code = "0000"; apiResult.Data = bl; @@ -275,11 +274,11 @@ namespace FrontendWebApi.ApiControllers { var sqlString = $@"select ofi.*, v2.system_key from operation_firm ofi - left join variable v1 on ofi.device_system_category_layer2 = v1.system_value and v1.system_type = @main_system_type and v1.delted = 0 + left join variable v1 on ofi.device_system_category_layer2 = v1.system_value and v1.system_type = @main_system_type and v1.deleted = 0 left join variable v2 on v1.id = v2.system_parent_id and ofi.device_system_category_layer3 = v2.system_value and v2.system_type = @sub_system_type and v2.deleted = 0 where ofi.deleted = 0"; var sheet = workbook.CreateSheet("廠商資料"); - var operation_firm = backendRepository.GetAllAsync(sqlString, null); + var operation_firm = backendRepository.GetAllAsync(sqlString, new { @main_system_type = main_system_type, @sub_system_type = sub_system_type }); int RowPosition = 0; #region set cell IRow row = sheet.CreateRow(RowPosition); @@ -962,8 +961,7 @@ namespace FrontendWebApi.ApiControllers return apiResult; } - #endregion - #region 維修/保養 + /// /// 維修/保養 讀取(work_type) ///