修改廠商export excel api
This commit is contained in:
		
							parent
							
								
									7ef789693e
								
							
						
					
					
						commit
						3a6bcd530e
					
				@ -107,7 +107,7 @@ namespace FrontendWebApi.ApiControllers
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            try
 | 
					            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<BuildingList>(sqlString, new { @main_system_tag = b.main_system_tag, @sub_system_tag = b.sub_system_tag });
 | 
					                bl = await backendRepository.GetAllAsync<BuildingList>(sqlString, new { @main_system_tag = b.main_system_tag, @sub_system_tag = b.sub_system_tag });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -137,12 +137,11 @@ namespace FrontendWebApi.ApiControllers
 | 
				
			|||||||
            try
 | 
					            try
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                var sqlString = @$"select d.device_building_tag, b.full_name as building_name
 | 
					                var sqlString = @$"select d.device_building_tag, b.full_name as building_name
 | 
				
			||||||
                                   from device d
 | 
					                                   from building b 
 | 
				
			||||||
                                   join building b on d.device_building_tag = b.building_tag
 | 
					                                   where deleted = 0 and area_tag = @device_area_tag
 | 
				
			||||||
                                   where d.deleted = 0 and d.device_area_tag = @device_area_tag
 | 
					 | 
				
			||||||
                                   group by b.full_name, d.device_building_tag";
 | 
					                                   group by b.full_name, d.device_building_tag";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                bl = await backendRepository.GetAllAsync<BuildingList>(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<BuildingList>(sqlString, new { @device_area_tag = b.device_area_tag });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                apiResult.Code = "0000";
 | 
					                apiResult.Code = "0000";
 | 
				
			||||||
                apiResult.Data = bl;
 | 
					                apiResult.Data = bl;
 | 
				
			||||||
@ -169,12 +168,12 @@ namespace FrontendWebApi.ApiControllers
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            try
 | 
					            try
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                var sqlString = @$"select d.device_floor_tag
 | 
					                var sqlString = @$"select full_name as device_floor_tag
 | 
				
			||||||
                                   from device d
 | 
					                                   from floor
 | 
				
			||||||
                                   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
 | 
					                                   where deleted = 0 and building_tag = @device_building_tag
 | 
				
			||||||
                                   group by d.device_floor_tag";
 | 
					                                   group by full_name";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                bl = await backendRepository.GetAllAsync<BuildingList>(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<BuildingList>(sqlString, new { @device_building_tag = b.device_building_tag });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                apiResult.Code = "0000";
 | 
					                apiResult.Code = "0000";
 | 
				
			||||||
                apiResult.Data = bl;
 | 
					                apiResult.Data = bl;
 | 
				
			||||||
@ -275,11 +274,11 @@ namespace FrontendWebApi.ApiControllers
 | 
				
			|||||||
            {
 | 
					            {
 | 
				
			||||||
                var sqlString = $@"select ofi.*, v2.system_key
 | 
					                var sqlString = $@"select ofi.*, v2.system_key
 | 
				
			||||||
                                from operation_firm ofi
 | 
					                                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
 | 
					                                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";
 | 
					                                    where ofi.deleted = 0";
 | 
				
			||||||
                var sheet = workbook.CreateSheet("廠商資料");
 | 
					                var sheet = workbook.CreateSheet("廠商資料");
 | 
				
			||||||
                var operation_firm = backendRepository.GetAllAsync<Operation_Firm>(sqlString, null);
 | 
					                var operation_firm = backendRepository.GetAllAsync<Operation_Firm>(sqlString, new { @main_system_type = main_system_type, @sub_system_type = sub_system_type });
 | 
				
			||||||
                int RowPosition = 0;
 | 
					                int RowPosition = 0;
 | 
				
			||||||
                #region set cell
 | 
					                #region set cell
 | 
				
			||||||
                IRow row = sheet.CreateRow(RowPosition);
 | 
					                IRow row = sheet.CreateRow(RowPosition);
 | 
				
			||||||
@ -962,8 +961,7 @@ namespace FrontendWebApi.ApiControllers
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            return apiResult;
 | 
					            return apiResult;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        #endregion
 | 
					        
 | 
				
			||||||
        #region 維修/保養
 | 
					 | 
				
			||||||
        /// <summary>
 | 
					        /// <summary>
 | 
				
			||||||
        /// 維修/保養 讀取(work_type)
 | 
					        /// 維修/保養 讀取(work_type)
 | 
				
			||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user