Sfoglia il codice sorgente

Merge branch 'master' of bn.git:plabudda/se

Piotr Labudda 8 anni fa
parent
commit
2d1a9570a5

+ 4 - 4
SE/se-lib/ProjectKosztorysSchema.php

@@ -28,7 +28,7 @@ class ProjectKosztorysSchema {
 					left join CRM_LISTA_ZASOBOW c  on(c.PARENT_ID = z.ID)
 					left join CRM_LISTA_ZASOBOW c  on(c.PARENT_ID = z.ID)
 					left join CRM_LISTA_ZASOBOW a  on(a.ID  = z.ALIAS_ID and z.ALIAS_ID > 0)
 					left join CRM_LISTA_ZASOBOW a  on(a.ID  = z.ALIAS_ID and z.ALIAS_ID > 0)
 					left join CRM_LISTA_ZASOBOW za on(za.ID = c.ALIAS_ID and c.ALIAS_ID > 0)
 					left join CRM_LISTA_ZASOBOW za on(za.ID = c.ALIAS_ID and c.ALIAS_ID > 0)
-				where z.PARENT_ID = 22444  -- TODO how to find ID, Typespecial with link
+				where z.PARENT_ID = 22444  -- TODO how to find ID, Typespecial with link (maybe Child of table IN7_MK_BAZA_DYSTRYBUCJI )
 			");
 			");
 			$sth->execute();
 			$sth->execute();
 			$rawConf = $sth->fetchAll();
 			$rawConf = $sth->fetchAll();
@@ -37,9 +37,9 @@ class ProjectKosztorysSchema {
 			$conf['layer'] = array();
 			$conf['layer'] = array();
 			foreach ($rawConf as $z) {
 			foreach ($rawConf as $z) {
 				if (('INNE' == $z['TYPE']) or ('TYP_KOSZTU' == $z['TYPE']) ) {
 				if (('INNE' == $z['TYPE']) or ('TYP_KOSZTU' == $z['TYPE']) ) {
-					if (!array_key_exists($z['ID'], $conf['type'])) {
-						$conf['type'][$z['ID']] = $z['DESC'];
-					}
+				//	if (!array_key_exists($z['ID'], $conf['type'])) {
+						$conf['type'][$z['ID']] = $z['DESC']; //? TODO to nie psuje przypadkiem, jak ten sam typ jest uzyty dla paru tabel?
+				//	}
 				}
 				}
 			}
 			}
 			foreach ($rawConf as $z) {
 			foreach ($rawConf as $z) {

+ 91 - 0
SE/superedit-DB_PROCEDURES_CREATE.php

@@ -1278,6 +1278,97 @@ update USERS2_MARKETING m, BUILDINGS b set m.the_geom=ST_Centroid(b.the_geom) wh
 END
 END
 ";
 ";
 
 
+// # Zarazanie Rozdzielcza* ID_PROJECT na bazie najmniejszej sprawy, tam gdzie nie ma ustalonego ID_PROJECT
+$sql['ROZDZIELCZA_the_geom_ID_PROJECT_event_drop']="DROP EVENT if exists ROZDZIELCZA_the_geom_ID_PROJECT";
+
+
+$sql['ROZDZIELCZA_the_geom_ID_PROJECT_event']="CREATE EVENT `ROZDZIELCZA_the_geom_ID_PROJECT` ON SCHEDULE EVERY 1 DAY STARTS '2015-05-12 00:05:30' ON COMPLETION NOT PRESERVE ENABLE DO
+BEGIN
+create temporary table IN7_MK_BAZA_DYSTRYBUCJI_temp select ID,the_geom from IN7_MK_BAZA_DYSTRYBUCJI where the_geom is not null;
+
+update Rozdzielcza_PionyKablowe as b 
+							inner join (
+							select p.ID , p.the_geom from IN7_MK_BAZA_DYSTRYBUCJI_temp as p    group by p.ID order by ST_Area(p.the_geom) 
+							) as p on   ST_Intersects(p.the_geom,b.the_geom)
+							set b.ID_PROJECT=p.ID where  b.ID_PROJECT<1  ;
+							
+update Rozdzielcza_Mikrokanalizacja_do_klienta as b 
+							inner join (
+							select p.ID , p.the_geom from IN7_MK_BAZA_DYSTRYBUCJI_temp as p    group by p.ID order by ST_Area(p.the_geom) 
+							) as p on   ST_Intersects(p.the_geom,b.the_geom)
+							set b.ID_PROJECT=p.ID where  b.ID_PROJECT<1  ;
+
+
+update Rozdzielcza_rurociag_wsg84 as b 
+							inner join (
+							select p.ID , p.the_geom from IN7_MK_BAZA_DYSTRYBUCJI_temp as p    group by p.ID order by ST_Area(p.the_geom) 
+							) as p on   ST_Intersects(p.the_geom,b.the_geom)
+							set b.ID_PROJECT=p.ID where  b.ID_PROJECT<1  ;
+							
+							
+update Rozdzielcza_wezly as b 
+							inner join (
+							select p.ID , p.the_geom from IN7_MK_BAZA_DYSTRYBUCJI_temp as p    group by p.ID order by ST_Area(p.the_geom) 
+							) as p on   ST_Intersects(p.the_geom,b.the_geom)
+							set b.ID_PROJECT=p.ID where  b.ID_PROJECT<1  ;
+						
+update Rozdzielcza_koszty_dodatkowe_wsg84 as b 
+							inner join (
+							select p.ID , p.the_geom from IN7_MK_BAZA_DYSTRYBUCJI_temp as p    group by p.ID order by ST_Area(p.the_geom) 
+							) as p on   ST_Intersects(p.the_geom,b.the_geom)
+							set b.ID_PROJECT=p.ID where  b.ID_PROJECT<1  ;
+											
+update Rozdzielcza_Wykop_przedmiar_na_mikrorurki as b 
+							inner join (
+							select p.ID , p.the_geom from IN7_MK_BAZA_DYSTRYBUCJI_temp as p    group by p.ID order by ST_Area(p.the_geom) 
+							) as p on   ST_Intersects(p.the_geom,b.the_geom)
+							set b.ID_PROJECT=p.ID where  b.ID_PROJECT<1  ;
+							
+update Rozdzielcza_Kabel_swiatl_we_wtornej as b 
+							inner join (
+							select p.ID , p.the_geom from IN7_MK_BAZA_DYSTRYBUCJI_temp as p    group by p.ID order by ST_Area(p.the_geom) 
+							) as p on   ST_Intersects(p.the_geom,b.the_geom)
+							set b.ID_PROJECT=p.ID where  b.ID_PROJECT<1  ;
+
+update Rozdzielcza_Przeciski_110mm as b 
+							inner join (
+							select p.ID , p.the_geom from IN7_MK_BAZA_DYSTRYBUCJI_temp as p    group by p.ID order by ST_Area(p.the_geom) 
+							) as p on   ST_Intersects(p.the_geom,b.the_geom)
+							set b.ID_PROJECT=p.ID where  b.ID_PROJECT<1  ;
+
+update Rozdzielcza_rura_oslonowa_magistralna as b 
+							inner join (
+							select p.ID , p.the_geom from IN7_MK_BAZA_DYSTRYBUCJI_temp as p    group by p.ID order by ST_Area(p.the_geom) 
+							) as p on   ST_Intersects(p.the_geom,b.the_geom)
+							set b.ID_PROJECT=p.ID where  b.ID_PROJECT<1  ;
+
+update Rozdzielcza_Pakiet5MikrorurekMagistrala_WSG84 as b 
+							inner join (
+							select p.ID , p.the_geom from IN7_MK_BAZA_DYSTRYBUCJI_temp as p    group by p.ID order by ST_Area(p.the_geom) 
+							) as p on   ST_Intersects(p.the_geom,b.the_geom)
+							set b.ID_PROJECT=p.ID where  b.ID_PROJECT<1  ;
+
+update Rozdzielcza_wewn_kabel_ethernet as b 
+							inner join (
+							select p.ID , p.the_geom from IN7_MK_BAZA_DYSTRYBUCJI_temp as p    group by p.ID order by ST_Area(p.the_geom) 
+							) as p on   ST_Intersects(p.the_geom,b.the_geom)
+							set b.ID_PROJECT=p.ID where  b.ID_PROJECT<1  ;
+
+update Rozdzielcza_struktura_wewnetrzna_wsg84 as b 
+							inner join (
+							select p.ID , p.the_geom from IN7_MK_BAZA_DYSTRYBUCJI_temp as p    group by p.ID order by ST_Area(p.the_geom) 
+							) as p on   ST_Intersects(p.the_geom,b.the_geom)
+							set b.ID_PROJECT=p.ID where  b.ID_PROJECT<1  ;
+
+update Rozdzielcza_Kabel_Swiatlowodowy_wsg84 as b 
+							inner join (
+							select p.ID , p.the_geom from IN7_MK_BAZA_DYSTRYBUCJI_temp as p    group by p.ID order by ST_Area(p.the_geom) 
+							) as p on   ST_Intersects(p.the_geom,b.the_geom)
+							set b.ID_PROJECT=p.ID where  b.ID_PROJECT<1  ;
+
+END
+";
+
 
 
 //! EOF ### powiazanie georeferencji z projektem oblotu:
 //! EOF ### powiazanie georeferencji z projektem oblotu: