[App] N4同步,device_kind加上group by
This commit is contained in:
		
							parent
							
								
									c6714a980b
								
							
						
					
					
						commit
						4d29bb220c
					
				@ -9,7 +9,7 @@
 | 
				
			|||||||
     connectionString="Data Source=192.168.0.201:33306;Initial Catalog=bims_mitsubishi;Persist Security Info=True;User ID=bims;Password=mjmdev_BIMS2022"
 | 
					     connectionString="Data Source=192.168.0.201:33306;Initial Catalog=bims_mitsubishi;Persist Security Info=True;User ID=bims;Password=mjmdev_BIMS2022"
 | 
				
			||||||
     providerName="MySql.Data.MySqlClient" />-->
 | 
					     providerName="MySql.Data.MySqlClient" />-->
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	  <add name="dbConStr" connectionString="server=192.168.0.201;user=bims;Database=bims_wsp;Port=33306;password=mjmdev_BIMS2022;charset='utf8';pooling=true;sslmode=none;;Connection Timeout=6000" providerName="MySql.Data.MySqlClient" />
 | 
						  <add name="dbConStr" connectionString="server=192.168.0.201;user=bims;Database=bims_mitsubishi;Port=33306;password=mjmdev_BIMS2022;charset='utf8';pooling=true;sslmode=none;;Connection Timeout=6000" providerName="MySql.Data.MySqlClient" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  </connectionStrings>
 | 
					  </connectionStrings>
 | 
				
			||||||
</configuration>
 | 
					</configuration>
 | 
				
			||||||
@ -81,19 +81,22 @@ namespace tpDomeWinAPP.Service
 | 
				
			|||||||
                {
 | 
					                {
 | 
				
			||||||
                    if (string.IsNullOrEmpty(row.tag_name)) continue;
 | 
					                    if (string.IsNullOrEmpty(row.tag_name)) continue;
 | 
				
			||||||
                    string[] arrTag = row.tag_name.Split('_');
 | 
					                    string[] arrTag = row.tag_name.Split('_');
 | 
				
			||||||
 | 
					                    if (arrTag.Length == 8)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    sb.Append($@" insert import_niagara_tag(niagara_tags, device_area_tag, device_building_tag, device_system_tag,
 | 
					                        sb.Append($@" insert import_niagara_tag(niagara_tags, device_area_tag, device_building_tag, device_system_tag,
 | 
				
			||||||
                                device_name_tag, device_floor_tag, device_master_tag, device_last_name_tag, device_serial_tag, atDateTime) values('" +
 | 
					                                device_name_tag, device_floor_tag, device_master_tag, device_last_name_tag, device_serial_tag, atDateTime) values('" +
 | 
				
			||||||
                        row.tag_name + "', '" +
 | 
					                            row.tag_name + "', '" +
 | 
				
			||||||
                        arrTag[0] + "', '" +
 | 
					                            arrTag[0] + "', '" +
 | 
				
			||||||
                        arrTag[1] + "', '" +
 | 
					                            arrTag[1] + "', '" +
 | 
				
			||||||
                        arrTag[2] + "', '" +
 | 
					                            arrTag[2] + "', '" +
 | 
				
			||||||
                        arrTag[3] + "', '" +
 | 
					                            arrTag[3] + "', '" +
 | 
				
			||||||
                        arrTag[4] + "', '" +
 | 
					                            arrTag[4] + "', '" +
 | 
				
			||||||
                        arrTag[5] + "', '" +
 | 
					                            arrTag[5] + "', '" +
 | 
				
			||||||
                        arrTag[6] + "', '" +
 | 
					                            arrTag[6] + "', '" +
 | 
				
			||||||
                        arrTag[7] + "',  " +
 | 
					                            arrTag[7] + "',  " +
 | 
				
			||||||
                        "now());");
 | 
					                            "now());");
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                try
 | 
					                try
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
@ -137,21 +140,23 @@ namespace tpDomeWinAPP.Service
 | 
				
			|||||||
                {
 | 
					                {
 | 
				
			||||||
                    if (string.IsNullOrEmpty(row.tag_name)) continue;
 | 
					                    if (string.IsNullOrEmpty(row.tag_name)) continue;
 | 
				
			||||||
                    string[] arrTag = row.tag_name.Split('_');
 | 
					                    string[] arrTag = row.tag_name.Split('_');
 | 
				
			||||||
 | 
					                    if (arrTag.Length == 8)
 | 
				
			||||||
                    #region for item
 | 
					                    {
 | 
				
			||||||
                    device_item8 row_item = new device_item8();
 | 
					                        #region for item
 | 
				
			||||||
                    row_item.tag_name = row.tag_name;
 | 
					                        device_item8 row_item = new device_item8();
 | 
				
			||||||
                    row_item.device_area_tag = arrTag[0];
 | 
					                        row_item.tag_name = row.tag_name;
 | 
				
			||||||
                    row_item.device_building_tag = arrTag[1];
 | 
					                        row_item.device_area_tag = arrTag[0];
 | 
				
			||||||
                    row_item.device_system_tag = arrTag[2];
 | 
					                        row_item.device_building_tag = arrTag[1];
 | 
				
			||||||
                    row_item.device_name_tag = arrTag[3];
 | 
					                        row_item.device_system_tag = arrTag[2];
 | 
				
			||||||
                    row_item.device_floor_tag = arrTag[4];
 | 
					                        row_item.device_name_tag = arrTag[3];
 | 
				
			||||||
                    row_item.device_master_tag = arrTag[5];
 | 
					                        row_item.device_floor_tag = arrTag[4];
 | 
				
			||||||
                    row_item.device_last_name_tag = arrTag[6];
 | 
					                        row_item.device_master_tag = arrTag[5];
 | 
				
			||||||
                    row_item.device_serial_tag = arrTag[7];
 | 
					                        row_item.device_last_name_tag = arrTag[6];
 | 
				
			||||||
                    row_item.point_name = row.point_name;
 | 
					                        row_item.device_serial_tag = arrTag[7];
 | 
				
			||||||
                    dt_item.Add(row_item);
 | 
					                        row_item.point_name = row.point_name;
 | 
				
			||||||
                    #endregion
 | 
					                        dt_item.Add(row_item);
 | 
				
			||||||
 | 
					                        #endregion
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                //device_item
 | 
					                //device_item
 | 
				
			||||||
@ -221,6 +226,18 @@ namespace tpDomeWinAPP.Service
 | 
				
			|||||||
                //新增至device, is_link = 1
 | 
					                //新增至device, is_link = 1
 | 
				
			||||||
                if (result.Count > 0)
 | 
					                if (result.Count > 0)
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
 | 
					                    var result2 = result.GroupBy(x => new
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        device_building_tag2 = x.device_building_tag,
 | 
				
			||||||
 | 
					                        device_system_tag2 = x.device_system_tag,
 | 
				
			||||||
 | 
					                        device_name_tag2 = x.device_name_tag
 | 
				
			||||||
 | 
					                    }).Select(x => new device_item8
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        device_building_tag = x.Key.device_building_tag2,
 | 
				
			||||||
 | 
					                        device_system_tag = x.Key.device_system_tag2,
 | 
				
			||||||
 | 
					                        device_name_tag = x.Key.device_name_tag2
 | 
				
			||||||
 | 
					                    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    foreach (var data in result)
 | 
					                    foreach (var data in result)
 | 
				
			||||||
                    {
 | 
					                    {
 | 
				
			||||||
                        sb.Append($@" insert device(device_guid, deleted, status, priority, is_link, device_area_tag, 
 | 
					                        sb.Append($@" insert device(device_guid, deleted, status, priority, is_link, device_area_tag, 
 | 
				
			||||||
@ -238,14 +255,18 @@ namespace tpDomeWinAPP.Service
 | 
				
			|||||||
                                data.device_serial_tag + "', '" +
 | 
					                                data.device_serial_tag + "', '" +
 | 
				
			||||||
                                data.niagara_tags + "', '" +  
 | 
					                                data.niagara_tags + "', '" +  
 | 
				
			||||||
                                data.device_system_tag + "', now(), now() );");
 | 
					                                data.device_system_tag + "', now(), now() );");
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    foreach (var data in result2)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
                        sb2.Append($@"INSERT device_kind (device_kind_guid, device_building_tag, device_system_tag, device_name_tag, 
 | 
					                        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, 
 | 
					                                    device_normal_flashing, device_close_flashing, device_error_flashing, device_error_independent, 
 | 
				
			||||||
                                    created_by, created_at)
 | 
					                                    created_by, created_at)
 | 
				
			||||||
                                    VALUES (uuid(), '" + data.device_building_tag + "', '" + data.device_system_tag + "', '" + data.device_name_tag +
 | 
					                                    VALUES (uuid(), '" + data.device_building_tag + "', '" + data.device_system_tag + "', '" + data.device_name_tag +
 | 
				
			||||||
                                    "', 0, 0, 1, 0, 'B43E3CA7-96DD-4FC7-B6E6-974ACC3B0878', now());");
 | 
					                                    "', 0, 0, 1, 0, 'B43E3CA7-96DD-4FC7-B6E6-974ACC3B0878', now());");
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    if(sb.Length > 0)
 | 
					
 | 
				
			||||||
 | 
					                    if (sb.Length > 0)
 | 
				
			||||||
                    {
 | 
					                    {
 | 
				
			||||||
                        conn.Execute(sb.ToString());
 | 
					                        conn.Execute(sb.ToString());
 | 
				
			||||||
                        conn.Execute(sb2.ToString());
 | 
					                        conn.Execute(sb2.ToString());
 | 
				
			||||||
 | 
				
			|||||||
@ -167,10 +167,10 @@ namespace tpDomeWinAPP
 | 
				
			|||||||
            {
 | 
					            {
 | 
				
			||||||
                webRequestSvc svc = new webRequestSvc();
 | 
					                webRequestSvc svc = new webRequestSvc();
 | 
				
			||||||
                string url_slot2 = "slot:/NTPC/B1|";//wsp
 | 
					                string url_slot2 = "slot:/NTPC/B1|";//wsp
 | 
				
			||||||
                string bql = url_slot2 + "bql:select " + top100 + " * from control:ControlPoint ";//三菱: url_slot; wsp: url_slot2
 | 
					                string bql = url_slot + "bql:select " + top100 + " * from control:ControlPoint ";//三菱: url_slot; wsp: url_slot2
 | 
				
			||||||
                //ds = svc.obixQuery("http://60.251.164.125:8080/obix/config/Arena/Program/ObixQuery/query/", bql);
 | 
					                //ds = svc.obixQuery("http://60.251.164.125:8080/obix/config/Arena/Program/ObixQuery/query/", bql);
 | 
				
			||||||
                //ds = svc.obixQuery("http://192.168.0.136:8080/obix/config/Program/ObixQuery/query/", bql);//三菱
 | 
					                ds = svc.obixQuery("http://192.168.0.136:8080/obix/config/Program/ObixQuery/query/", bql);//三菱
 | 
				
			||||||
                ds = svc.obixQuery("http://192.168.0.136:8081/obix/config/Program/ObixQuery/query/", bql);//wsp
 | 
					                //ds = svc.obixQuery("http://192.168.0.136:8081/obix/config/Program/ObixQuery/query/", bql);//wsp
 | 
				
			||||||
                //ds = svc.obixQuery("http://localhost:8080/obix/config/Program/ObixQuery/query/", bql);            
 | 
					                //ds = svc.obixQuery("http://localhost:8080/obix/config/Program/ObixQuery/query/", bql);            
 | 
				
			||||||
                dataGridView1.DataSource = ds;
 | 
					                dataGridView1.DataSource = ds;
 | 
				
			||||||
                dataGridView1.Columns[0].Visible = false;
 | 
					                dataGridView1.Columns[0].Visible = false;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user