App: device_kind 新增資料
This commit is contained in:
		
							parent
							
								
									4e7be43093
								
							
						
					
					
						commit
						2657e41a15
					
				@ -30,7 +30,7 @@ namespace tpDomeWinAPP.Service
 | 
			
		||||
        {
 | 
			
		||||
            bool result = false;
 | 
			
		||||
            //tag
 | 
			
		||||
            InsertNiagaraTagList(dt, building);
 | 
			
		||||
            insertNiagaraTagList(dt, building);
 | 
			
		||||
            insertItemFromNiagara(dt, building);
 | 
			
		||||
            deviceComparison();
 | 
			
		||||
            deviceItemComparison();
 | 
			
		||||
@ -39,7 +39,7 @@ namespace tpDomeWinAPP.Service
 | 
			
		||||
            return result;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        protected void InsertNiagaraTagList(List<device_value2> dt, string building)
 | 
			
		||||
        protected void insertNiagaraTagList(List<device_value2> dt, string building)
 | 
			
		||||
        {
 | 
			
		||||
            var ds2 = dt.GroupBy(x => new
 | 
			
		||||
            {
 | 
			
		||||
@ -209,6 +209,7 @@ namespace tpDomeWinAPP.Service
 | 
			
		||||
 | 
			
		||||
                conn.Open();
 | 
			
		||||
                StringBuilder sb = new StringBuilder();
 | 
			
		||||
                StringBuilder sb2 = new StringBuilder();
 | 
			
		||||
                sb.Append($@" SELECT m.*
 | 
			
		||||
                               FROM import_niagara_tag m
 | 
			
		||||
                               LEFT JOIN device d
 | 
			
		||||
@ -237,11 +238,19 @@ namespace tpDomeWinAPP.Service
 | 
			
		||||
                                data.device_serial_tag + "', '" +
 | 
			
		||||
                                data.niagara_tags + "', '" +  
 | 
			
		||||
                                data.device_system_tag + "', now(), now() );");
 | 
			
		||||
 | 
			
		||||
                        sb2.Append($@"INSERT device_kind (device_kind_guid, device_building_tag, device_system_tag, device_name_tag, 
 | 
			
		||||
                                    device_normal_flashing, device_close_flashing, device_error_flashing, device_error_independent, 
 | 
			
		||||
                                    created_by, created_at)
 | 
			
		||||
                                    VALUES (uuid(), '" + data.device_building_tag + "', '" + data.device_system_tag + "', '" + data.device_name_tag + 
 | 
			
		||||
                                    "', 0, 0, 1, 0, 'B43E3CA7-96DD-4FC7-B6E6-974ACC3B0878', now());");
 | 
			
		||||
                    }
 | 
			
		||||
                    if(sb.Length > 0)
 | 
			
		||||
                    {
 | 
			
		||||
                        conn.Execute(sb.ToString());
 | 
			
		||||
                        conn.Execute(sb2.ToString());
 | 
			
		||||
                        sb.Clear();
 | 
			
		||||
                        sb2.Clear();
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user