@@ -6,14 +6,14 @@ This version of Giswater is provided by Giswater Association
6
6
7
7
-- FUNCTION CODE:
8
8
9
- CREATE OR REPLACE FUNCTION ws1_2802 .gw_fct_admin_multiplicate_network(p_x integer , p_y integer , p_dx integer , p_dy integer )
9
+ CREATE OR REPLACE FUNCTION ws36010 .gw_fct_admin_multiplicate_network(p_x integer , p_y integer , p_dx integer , p_dy integer )
10
10
RETURNS json AS
11
11
$BODY$
12
12
13
13
/* example
14
14
15
15
-- execute
16
- SELECT ws1_2802 .gw_fct_admin_multiplicate_network(2,1,11000,15000 );
16
+ SELECT ws36010 .gw_fct_admin_multiplicate_network(2,1,1700,2300 );
17
17
18
18
*/
19
19
@@ -26,10 +26,10 @@ BEGIN
26
26
27
27
28
28
-- Set search path to local schema
29
- SET search_path = " ws1_2802 " , public;
29
+ SET search_path = " ws36010 " , public;
30
30
31
31
-- set previous
32
- ALTER TABLE ext_plot ALTER COLUMN id SET DEFAULT nextval(' ws1_2802 .urn_id_seq' ::regclass);
32
+ ALTER TABLE ext_plot ALTER COLUMN id SET DEFAULT nextval(' ws36010 .urn_id_seq' ::regclass);
33
33
34
34
ALTER TABLE node DISABLE TRIGGER gw_trg_edit_foreignkey;
35
35
ALTER TABLE node DISABLE TRIGGER gw_trg_node_arc_divide;
40
40
ALTER TABLE node DISABLE RULE insert_plan_psector_x_node;
41
41
42
42
ALTER TABLE arc DISABLE TRIGGER gw_trg_arc_noderotation_update;
43
- ALTER TABLE arc DISABLE TRIGGER gw_trg_arc_vnodelink_update;
44
43
ALTER TABLE arc DISABLE TRIGGER gw_trg_edit_foreignkey;
45
44
ALTER TABLE arc DISABLE TRIGGER gw_trg_topocontrol_arc;
46
45
ALTER TABLE arc DISABLE TRIGGER gw_trg_typevalue_fk;
64
63
FOR x IN 1 ..p_x
65
64
LOOP
66
65
67
- RAISE NOTICE ' X LOOP % , %' ,y,x;
66
+ RAISE NOTICE ' X LOOP % , %' , y,x;
68
67
69
68
RAISE NOTICE ' nodes' ;
70
69
INSERT INTO node (code, elevation, depth, nodecat_id, epa_type, sector_id, arc_id, parent_id, state, state_type, annotation, observ,comment, dma_id, presszone_id,
85
84
INSERT INTO inp_pump SELECT node_id FROM node WHERE state > 0 and epa_type = ' PUMP' ON CONFLICT (node_id) DO NOTHING;
86
85
INSERT INTO inp_shortpipe SELECT node_id FROM node WHERE state > 0 and epa_type = ' SHORTPIPE' ON CONFLICT (node_id) DO NOTHING;
87
86
87
+
88
88
-- TODO: insert man_junctio & others nodes.....
89
89
90
90
RAISE NOTICE ' arcs' ;
99
99
100
100
INSERT INTO inp_pipe SELECT arc_id FROM arc WHERE state > 0 and epa_type = ' PIPE' ON CONFLICT (arc_id) DO NOTHING;
101
101
INSERT INTO inp_virtualvalve SELECT arc_id FROM arc WHERE state > 0 and epa_type = ' VIRTUALVALVE' ON CONFLICT (arc_id) DO NOTHING;
102
+ INSERT INTO inp_virtualpump SELECT arc_id FROM arc WHERE state > 0 and epa_type = ' VIRTUALPUMP' ON CONFLICT (arc_id) DO NOTHING;
102
103
103
104
-- TODO: insert man_pipe
104
105
@@ -107,22 +108,23 @@ BEGIN
107
108
function_type, category_type, fluid_type, location_type, workcat_id, workcat_id_end, workcat_id_plan, buildercat_id, builtdate, enddate, ownercat_id, streetaxis2_id, postnumber, postnumber2,
108
109
muni_id, streetaxis_id, postcode, district_id, postcomplement, postcomplement2, descript, link, verified, rotation, the_geom, undelete, label_x,label_y,label_rotation, expl_id,
109
110
publish, inventory,num_value, connec_length, arc_id, minsector_id, dqa_id, staticpressure, pjoint_id, pjoint_type,
110
- adate, adescript, accessibility, lastupdate, lastupdate_user, asset_id, epa_type)
111
+ adate, adescript, accessibility, lastupdate, lastupdate_user, asset_id, epa_type,
112
+ om_state, conserv_state, priority, valve_location, valve_type, shutoff_valve, access_type, placement_type, crmzone_id, expl_id2, plot_code)
111
113
SELECT code, elevation, depth,connecat_id, sector_id, customer_code, state, state_type, annotation, observ, comment,dma_id, presszone_id, soilcat_id,
112
114
function_type, category_type, fluid_type, location_type, workcat_id, workcat_id_end, workcat_id_plan, buildercat_id, builtdate, enddate, ownercat_id, streetaxis2_id, postnumber, postnumber2,
113
115
muni_id, streetaxis_id, postcode, district_id, postcomplement, postcomplement2, descript, link, verified, rotation, st_translate(the_geom,x* p_dx,y* p_dy), undelete, label_x,label_y,label_rotation, expl_id,
114
116
publish, inventory,num_value, connec_length, arc_id, minsector_id, dqa_id, staticpressure, pjoint_id, pjoint_type,
115
- adate, adescript, accessibility, lastupdate, lastupdate_user, asset_id, epa_type FROM connec;
117
+ adate, adescript, accessibility, lastupdate, lastupdate_user, asset_id, epa_type, om_state, conserv_state, priority, valve_location, valve_type, shutoff_valve, access_type,
118
+ placement_type, crmzone_id, expl_id2, plot_code FROM connec;
116
119
117
120
INSERT INTO inp_connec SELECT connec_id FROM connec WHERE epa_type = ' JUNCTION' ON CONFLICT (connec_id) DO NOTHING;
118
121
119
122
RAISE NOTICE ' links' ;
120
- INSERT INTO link (feature_type, feature_id, expl_id, exit_id, exit_type, userdefined_geom, state, the_geom, vnode_topelev)
121
- SELECT feature_type, feature_id, expl_id, exit_id, exit_type, userdefined_geom, state, st_translate(the_geom,x* p_dx,y* p_dy), vnode_topelev FROM link;
122
-
123
- RAISE NOTICE ' Vnode' ;
124
- INSERT INTO vnode (state, the_geom)
125
- SELECT state, st_translate(the_geom,x* p_dx,y* p_dy) FROM vnode;
123
+ INSERT INTO link (feature_type, feature_id, expl_id, exit_id, exit_type, userdefined_geom, state, the_geom, exit_topelev,
124
+ exit_elev, sector_id, dma_id, fluid_type, presszone_id, dqa_id, minsector_id,expl_id2, epa_type, is_operative, insert_user, lastupdate, lastupdate_user, connecat_id, workcat_id, workcat_id_end, builtdate, enddate)
125
+ SELECT feature_type, feature_id, expl_id, exit_id, exit_type, userdefined_geom, state, st_translate(the_geom,x* p_dx,y* p_dy), exit_topelev,
126
+ exit_elev, sector_id, dma_id, fluid_type, presszone_id, dqa_id, minsector_id,expl_id2, epa_type, is_operative, insert_user, lastupdate, lastupdate_user, connecat_id, workcat_id, workcat_id_end, builtdate, enddate
127
+ FROM link;
126
128
127
129
RAISE NOTICE ' Plot' ;
128
130
INSERT INTO ext_plot (plot_code, muni_id, postcode, streetaxis_id, postnumber, complement, placement, square, observ, text , the_geom, expl_id)
@@ -142,7 +144,6 @@ BEGIN
142
144
ALTER TABLE node ENABLE RULE insert_plan_psector_x_node;
143
145
144
146
ALTER TABLE arc ENABLE TRIGGER gw_trg_arc_noderotation_update;
145
- ALTER TABLE arc ENABLE TRIGGER gw_trg_arc_vnodelink_update;
146
147
ALTER TABLE arc ENABLE TRIGGER gw_trg_edit_foreignkey;
147
148
ALTER TABLE arc ENABLE TRIGGER gw_trg_topocontrol_arc;
148
149
ALTER TABLE arc ENABLE TRIGGER gw_trg_typevalue_fk;
0 commit comments