|
1
|
|
|
2
|
|
|
3
|
do $$
|
|
4
|
declare
|
|
5
|
turma_serieX record;
|
|
6
|
codigoTurmaLE numeric;
|
|
7
|
idOrientacaoEducacional numeric;
|
|
8
|
discenteX record;
|
|
9
|
idMatriculaComponente numeric;
|
|
10
|
idMatriculaDiscenteSerie numeric;
|
|
11
|
codigoDisciplina text;
|
|
12
|
idSerie numeric;
|
|
13
|
idCurriculoMedio numeric;
|
|
14
|
begin
|
|
15
|
|
|
16
|
|
|
17
|
|
|
18
|
|
|
19
|
|
|
20
|
|
|
21
|
select 'OE221' into codigoDisciplina;
|
|
22
|
select 6 into idSerie;
|
|
23
|
select 22 into idCurriculoMedio;
|
|
24
|
|
|
25
|
|
|
26
|
|
|
27
|
select id_disciplina into idOrientacaoEducacional from ensino.componente_curricular where codigo=codigoDisciplina;
|
|
28
|
|
|
29
|
|
|
30
|
for turma_serieX in (select * from medio.turma_serie where ano=2019 and id_serie=idSerie and ativo=true)
|
|
31
|
loop
|
|
32
|
raise notice 'Iterando para cadastrar...';
|
|
33
|
raise notice 'turma_serie = %', turma_serieX.id_turma_serie;
|
|
34
|
select tsa.id_turma into codigoTurmaLE from ensino.turma t inner join ensino.componente_curricular cc on t.id_disciplina=cc.id_disciplina
|
|
35
|
inner join medio.turma_serie_ano tsa on t.id_turma=tsa.id_turma where tsa.id_turma_serie=turma_serieX.id_turma_serie and cc.codigo=codigoDisciplina;
|
|
36
|
|
|
37
|
|
|
38
|
for discenteX in
|
|
39
|
(select distinct id_discente from ensino.matricula_componente where id_turma in
|
|
40
|
(select id_turma from medio.turma_serie_ano where id_turma_serie=turma_serieX.id_turma_serie and ativo=true) and id_situacao_matricula=2)
|
|
41
|
loop
|
|
42
|
|
|
43
|
select nextval('ensino.matricula_componente_seq') into idMatriculaComponente;
|
|
44
|
|
|
45
|
|
|
46
|
INSERT INTO ensino.matricula_componente
|
|
47
|
(id_situacao_matricula, id_discente, media_final,
|
|
48
|
numero_faltas, id_matricula_componente, codmerg,
|
|
49
|
id_turma, id_recuperacao, apto,
|
|
50
|
codmergpa, id_registro_atividade, id_registro_entrada,
|
|
51
|
data_cadastro, id_conceito_nota_apagar, foiretificada,
|
|
52
|
codmergpapos, ano, periodo,
|
|
53
|
id_componente_curricular, id_restricoes, tipo_integralizacao,
|
|
54
|
id_componente_detalhes, recuperacao, conceito_apagar,
|
|
55
|
mes, mes_fim, ano_fim,
|
|
56
|
processamento_rematricula, observacao, codmergppgeec,
|
|
57
|
id_usuario_consolidacao, data_consolidacao, rematricula,
|
|
58
|
ano_inicio, id_serie, porcentagem_frequencia,
|
|
59
|
consolidacao_sem_notas, dependencia, consolidado_pendente_divulgacao,
|
|
60
|
nota_minima, em_regime_observacao, prioritario)
|
|
61
|
VALUES(2, discenteX.id_discente, NULL,
|
|
62
|
NULL, idMatriculaComponente, NULL,
|
|
63
|
codigoTurmaLE, NULL, NULL,
|
|
64
|
NULL, NULL, null,
|
|
65
|
now(), NULL, NULL,
|
|
66
|
NULL, 2019, 0,
|
|
67
|
idOrientacaoEducacional, NULL, NULL,
|
|
68
|
(select id_componente_detalhes from ENSINO.componente_curricular_detalhes cd where cd.id_componente=idOrientacaoEducacional), NULL, NULL,
|
|
69
|
1, NULL, NULL,
|
|
70
|
NULL, NULL, NULL,
|
|
71
|
NULL, NULL, NULL,
|
|
72
|
2019, turma_serieX.id_serie, NULL,
|
|
73
|
false, NULL, NULL,
|
|
74
|
NULL, false, NULL);
|
|
75
|
|
|
76
|
raise notice 'cadastro matricula_componente para o discente %', discenteX.id_discente;
|
|
77
|
|
|
78
|
if (select count(*) from medio.matricula_discente_serie where id_discente=discenteX.id_discente and id_turma_serie = turma_serieX.id_turma_serie) = 0
|
|
79
|
then
|
|
80
|
|
|
81
|
select nextval('hibernate_sequence') into idMatriculaDiscenteSerie;
|
|
82
|
|
|
83
|
INSERT INTO medio.matricula_discente_serie
|
|
84
|
(id_matricula_discente_serie, id_discente, id_situacao_matricula_serie,
|
|
85
|
situacao_final, id_turma_serie, id_curriculo_medio,
|
|
86
|
dependencia, id_registro_entrada, data_cadastro,
|
|
87
|
num_chamada, compulsoria, id_escola,
|
|
88
|
media_final, frequencia_anual)
|
|
89
|
VALUES(idMatriculaDiscenteSerie, discenteX.id_discente, 1,
|
|
90
|
NULL, turma_serieX.id_turma_serie, idCurriculoMedio,
|
|
91
|
false, null, now(),
|
|
92
|
NULL, false, NULL,
|
|
93
|
NULL, NULL);
|
|
94
|
raise notice 'Cadastrado matricula_discente_serie para o discente %', discenteX.id_discente;
|
|
95
|
|
|
96
|
INSERT INTO medio.matricula_componente_serie
|
|
97
|
(id_matricula_componente_serie, id_matricula_discente_serie, id_matricula_componente,
|
|
98
|
ativo, data_cadastro, id_registro_entrada,
|
|
99
|
dependencia)
|
|
100
|
VALUES((select nextval('hibernate_sequence')), idMatriculaDiscenteSerie, idMatriculaComponente,
|
|
101
|
true, now(), null,
|
|
102
|
false);
|
|
103
|
raise notice 'Cadastrado medio.matricula_componente_serie para o discente %', discenteX.id_discente;
|
|
104
|
|
|
105
|
else
|
|
106
|
|
|
107
|
select id_matricula_discente_serie into idMatriculaDiscenteSerie from medio.matricula_discente_serie
|
|
108
|
where id_discente=discenteX.id_discente and id_turma_serie = turma_serieX.id_turma_serie;
|
|
109
|
|
|
110
|
INSERT INTO medio.matricula_componente_serie
|
|
111
|
(id_matricula_componente_serie, id_matricula_discente_serie, id_matricula_componente,
|
|
112
|
ativo, data_cadastro, id_registro_entrada,
|
|
113
|
dependencia)
|
|
114
|
VALUES((select nextval('hibernate_sequence')), idMatriculaDiscenteSerie, idMatriculaComponente,
|
|
115
|
true, now(), null,
|
|
116
|
false);
|
|
117
|
raise notice 'Cadastrado medio.matricula_componente_serie para o discente %', discenteX.id_discente;
|
|
118
|
end if;
|
|
119
|
|
|
120
|
|
|
121
|
end loop;
|
|
122
|
end loop;
|
|
123
|
end;
|
|
124
|
$$ language plpgsql;
|
|
125
|
|
|
126
|
|
|
127
|
|
|
128
|
|
|
129
|
|
|
130
|
|
|
131
|
select id_disciplina from ensino.componente_curricular where codigo='OE161';
|
|
132
|
select * from MEDIO.curriculo_medio_componente where id_componente_curricular=309
|
|
133
|
|
|
134
|
|
|
135
|
update MEDIO.CURRICULO_MEDIO_COMPONENTE set ID_CURRICULO_MEDIO=19
|
|
136
|
where id_componente_curricular=(select id_disciplina from ensino.componente_curricular where codigo='OE191');
|
|
137
|
|
|
138
|
|
|
139
|
select * from MEDIO.CURRICULO_MEDIO
|
|
140
|
|
|
141
|
|
|
142
|
|
|
143
|
|
|
144
|
select * from ensino.matricula_componente where data_cadastro > '15/02/2019' and id_registro_entrada is null;
|
|
145
|
|
|
146
|
|
|
147
|
delete from ensino.matricula_componente where data_cadastro > '15/02/2019'
|
|
148
|
delete from ensino.matricula_componente where data_cadastro > '15/02/2019'
|
|
149
|
select * from medio.turma_serie_ano;
|
|
150
|
select * from medio.matricula_discente_serie where data_cadastro >= '15/02/2019';
|
|
151
|
delete from medio.matricula_discente_serie where data_cadastro >= '15/02/2019';
|
|
152
|
select * from medio.matricula_componente_serie where id_matricula_componente=7544
|
|
153
|
select * from medio.matricula_componente_serie where data_cadastro >= '15/02/2019'
|
|
154
|
delete from medio.matricula_componente_serie where data_cadastro >= '15/02/2019'
|
|
155
|
select nextval('ensino.matricula_componente_seq')
|
|
156
|
|
|
157
|
select max(id_matricula_componente) from ensino.matricula_componente
|
|
158
|
|
|
159
|
select count(*) from medio.matricula_discente_serie where id_discente=discenteX.id_discente and id_turma_serie = turma_serieX.id_turma_serie
|
|
160
|
select * from medio.matricula_discente_serie where id_discente=508 data_cadastro >= '15/02/2019';
|
|
161
|
delete from medio.matricula_componente_serie
|
|
162
|
delete from medio.matricula_discente_serie where
|
|
163
|
|
|
164
|
select * from medio.matricula_discente_serie where id_matricula_discente_serie=14342
|
|
165
|
|
|
166
|
select * from public.discente d inner join comum.pessoa p on d.id_pessoa=p.id_pessoa where p.nome like 'AGNES PEREIRA%'
|
|
167
|
|
|
168
|
|
|
169
|
|
|
170
|
select * from ensino.matricula_componente where id_discente=419
|
|
171
|
medio.matricula_componente_serie
|
|
172
|
medio.matricula_discente_serie
|
|
173
|
|
|
174
|
update ENSINO.matricula_componente set media_final=null where id_discente=487
|
|
175
|
|
|
176
|
select * from pub
|
|
177
|
|
|
178
|
select
|
|
179
|
|
|
180
|
|
|
181
|
select * from medio.matricula_discente_serie mds inner join public.discente d on mds.id_discente=d.id_discente where d.nivel='M' and d.matricula=20183003547
|
|
182
|
select * from ensino.matricula_componente where data_cadastro >= '2019-02-18 11:20:49' order by data_cadastro desc
|
|
183
|
delete from ensino.matricula_componente where data_cadastro >= '2019-02-18 11:20:49'
|
|
184
|
|
|
185
|
select * from medio.matricula_componente_serie where data_cadastro >= '2019-02-18' order by id_matricula_componente_serie desc
|
|
186
|
|
|
187
|
delete from medio.matricula_componente_serie where id_matricula_componente_serie>14490
|
|
188
|
|