refactor:device_item檢查full_name為空,以points替代
This commit is contained in:
		
							parent
							
								
									f6dffd0ef3
								
							
						
					
					
						commit
						0db40ce635
					
				@ -146,6 +146,7 @@ namespace Backend.Controllers
 | 
			
		||||
                var building = ds.FirstOrDefault().device_building_tag;
 | 
			
		||||
                await niagaraDataSynchronizeRepository.InsertItemFromNiagara(ds, building);
 | 
			
		||||
                await niagaraDataSynchronizeRepository.DeviceItemComparison();
 | 
			
		||||
                await niagaraDataSynchronizeRepository.ItemCheckFullNameEmptyReplaceByDeviceName();
 | 
			
		||||
                result = true;
 | 
			
		||||
 | 
			
		||||
                apiResult.Code = "0000";
 | 
			
		||||
 | 
			
		||||
@ -520,7 +520,37 @@ namespace Repository.BackendRepository.Implement
 | 
			
		||||
                    try
 | 
			
		||||
                    {
 | 
			
		||||
                        StringBuilder sb = new StringBuilder();
 | 
			
		||||
                        sb.Append("update  bims_mitsubishi.device set full_name=device_number where full_Name='';");
 | 
			
		||||
                        sb.Append("update device set full_name=device_number where full_Name='';");
 | 
			
		||||
                        await conn.ExecuteAsync(sb.ToString());
 | 
			
		||||
                    }
 | 
			
		||||
                    catch (Exception exception)
 | 
			
		||||
                    {
 | 
			
		||||
                        throw exception;
 | 
			
		||||
                    }
 | 
			
		||||
                    finally
 | 
			
		||||
                    {
 | 
			
		||||
                        conn.Close();
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 檢查device_item內FullName為空的值,以points取代
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public async Task ItemCheckFullNameEmptyReplaceByDeviceName()
 | 
			
		||||
        {
 | 
			
		||||
            using (IDbConnection conn = GetDbConnection())
 | 
			
		||||
            {
 | 
			
		||||
                conn.Open();
 | 
			
		||||
                using (TransactionScope scope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
 | 
			
		||||
                {
 | 
			
		||||
                    try
 | 
			
		||||
                    {
 | 
			
		||||
                        StringBuilder sb = new StringBuilder();
 | 
			
		||||
                        sb.Append("update device_item set full_name = points where full_Name = '''''';");
 | 
			
		||||
                        await conn.ExecuteAsync(sb.ToString());
 | 
			
		||||
                    }
 | 
			
		||||
                    catch (Exception exception)
 | 
			
		||||
 | 
			
		||||
@ -36,6 +36,8 @@ namespace Repository.BackendRepository.Interface
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        Task DeviceItemComparison();
 | 
			
		||||
 | 
			
		||||
        Task ItemCheckFullNameEmptyReplaceByDeviceName();
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 新增資料至 buildingMenu
 | 
			
		||||
        /// </summary>
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user