dts-backoffice-util 19.2.0 → 19.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -12,7 +12,7 @@ Segue abaixo as últimas versões da Biblioteca, conforme a versão do PO-UI e A
12
12
 
13
13
  | PO-UI | Angular | Versão dtsBackofficeUtil |
14
14
  |-|-|-|
15
- | v19 | v19 | 19.2.0 |
15
+ | v19 | v19 | 19.3.0 |
16
16
  | v18 | v18 | 18.3.0 |
17
17
  | v17 | v17 | 17.1.0 |
18
18
  | v16 | v16 | 16.1.0 |
@@ -77,7 +77,7 @@ npm i rxjs-compat --save
77
77
  | paramSelections | Array | Não | Parâmetros de Seleção. Utilizado apenas pelo EMS5. |
78
78
  | disabledParams | boolean | Não | Quando for igual a **"Sim"**, irá desabilitar todos os campos do Agendamento (Data Execução, Servidor, Repetir ocorrência, etc...). |
79
79
  | loading | boolean | Não | Quando for igual a **"Sim"**, irá apresentar a tela de "loading" no momento da criação da agenda até o retorno do serviço. |
80
- | endExecution | EventEmitter | Não | Evento que será disparado ao finalizar o agendamento. Ele irá enviar como parâmetro um objeto da interface **IScheduleParameters**, contendo os parâmetros informados pelo usuário. |
80
+ | endExecution | EventEmitter | Não | Evento que será disparado ao finalizar o agendamento. Ele irá enviar como parâmetro um objeto da interface **IScheduleParameters**, contendo os parâmetros informados pelo usuário e o número da agenda criada no RPW. |
81
81
  ---
82
82
  **Métodos:**
83
83
 
@@ -119,6 +119,7 @@ Em conjunto com o parâmetro **endExecution** o método **setScheduleParameters*
119
119
  @ViewChild('schParam', { static: true }) schParam: TotvsScheduleExecutionComponent;
120
120
 
121
121
  scheduleParams: IScheduleParameters;
122
+ listExecutionID = new Array<string>();
122
123
  parametersRpw = new Array<any>();
123
124
  paramDigitDefRpw = new Array<any>();
124
125
  paramDigitDataRpw = new Array<any>();
@@ -164,6 +165,10 @@ createParametersRpw(): void {
164
165
 
165
166
  endExecutionSchedule(event): void {
166
167
  this.scheduleParams = event;
168
+
169
+ // Pega a lista dos códigos das Agendas criadas
170
+ this.listExecutionID = this.scheduleParams.listExecutionID;
171
+
167
172
  this.saveLocalStorage();
168
173
  }
169
174
 
@@ -193,21 +198,22 @@ DEFINE TEMP-TABLE tt-digita NO-UNDO
193
198
  Interfaces:
194
199
 
195
200
  IScheduleParameters
196
- | Nome | Tipo | Descrição | Valor - Label Valor |
197
- |-|-|-|-|
198
- | executionType | number | Tipo Execução | 1 - Executar Hoje<br>2 - Agendar Execução |
199
- | execAppointDate | date | Data Agendada | |
200
- | execAppointHour | string | Hora Agendada | |
201
- | executionServer | string | Servidor RPW | |
202
- | repeatExecution | boolean | Repetir Ocorrência | |
203
- | repeatType | number | Tipo Repetição | 1 - Diária<br>2 - Semanal<br>3 - Mensal |
204
- | frequency | string | Frequência | "no" - Uma vez no dia<br>"yes" - Várias vezes no dia |
205
- | frequencyValue | number | Quantidade da Frequência | |
206
- | frequencyType | string | Tipo Frequência | "hour" - Hora(s)<br>"minute" - Minuto(s) |
207
- | execAppointHourInit | string | Hora Inicial Frequência | |
208
- | execAppointHourFinal | string | Hora Final Frequência | |
209
- | selectWeeklys | Array | Dia da Semana<br>Frequência Semanal | Sunday - Domingo<br>Monday - Segunda<br>Tuesday - Terça<br>Wednesday - Quarta<br>Thursday - Quinta<br>Friday - Sexta<br>Saturday - Sábado |
210
- | dayOfMonth | number | Dia do Mês<br>Frequência Mensal | |
201
+ | Nome | Tipo | Descrição |
202
+ |-|-|-|
203
+ | executionType | number | Tipo Execução<br>Valor - Label Valor:<br>1 - Executar Hoje<br>2 - Agendar Execução |
204
+ | execAppointDate | date | Data Agendada |
205
+ | execAppointHour | string | Hora Agendada |
206
+ | executionServer | string | Servidor RPW |
207
+ | repeatExecution | boolean | Repetir Ocorrência |
208
+ | repeatType | number | Tipo Repetição<br>Valor - Label Valor:<br>1 - Diária<br>2 - Semanal<br>3 - Mensal |
209
+ | frequency | string | Frequência<br>Valor - Label Valor:<br>"no" - Uma vez no dia<br>"yes" - Várias vezes no dia |
210
+ | frequencyValue | number | Quantidade da Frequência |
211
+ | frequencyType | string | Tipo Frequência<br>Valor - Label Valor:<br>"hour" - Hora(s)<br>"minute" - Minuto(s) |
212
+ | execAppointHourInit | string | Hora Inicial Frequência |
213
+ | execAppointHourFinal | string | Hora Final Frequência |
214
+ | selectWeeklys | Array | Dia da Semana<br>Frequência Semanal<br>Valor - Label Valor:<br>Sunday - Domingo<br>Monday - Segunda<br>Tuesday - Terça<br>Wednesday - Quarta<br>Thursday - Quinta<br>Friday - Sexta<br>Saturday - Sábado |
215
+ | dayOfMonth | number | Dia do Mês<br>Frequência Mensal |
216
+ | listExecutionID | Array | Lista de Códigos das Agendas criadas. Quando o usuário cria uma agenda "simples" (que não se repete) é criado apenas um agendamento, portanto esta propriedade terá apenas um código. Mas, quando o usuário cria uma agenda que se repete, são criados dois agendamentos: um para executar "agora", e outro para executar "futuramente" com base nos parâmetros informados pelo usuário (diário, semana, mensal, frequência, etc...) |
211
217
  ---
212
218
  <br>
213
219
 
@@ -1856,6 +1856,19 @@ class TotvsScheduleExecutionComponent {
1856
1856
  if (!this.validate()) {
1857
1857
  return;
1858
1858
  }
1859
+ this.createJobScheduleParameters();
1860
+ this.model.listExecutionID = [];
1861
+ // Executa hoje ou agendada
1862
+ this.rpwService.createExecution(this.jsonObject, this.loading).subscribe({
1863
+ next: (response) => {
1864
+ this.finishSchedule(true, true, response);
1865
+ },
1866
+ error: () => {
1867
+ this.finishSchedule(true, false, null);
1868
+ }
1869
+ });
1870
+ }
1871
+ createJobScheduleParameters() {
1859
1872
  let idxParam;
1860
1873
  this.jsonObject = {};
1861
1874
  this.jsonObject.status = 'active';
@@ -1896,48 +1909,92 @@ class TotvsScheduleExecutionComponent {
1896
1909
  this.jsonObject.executionParameter.parametros[idxParam] = {};
1897
1910
  this.jsonObject.executionParameter.parametros[idxParam].selecoes = this.paramSelections;
1898
1911
  }
1899
- // Executa hoje ou agendada
1900
- this.rpwService.createExecution(this.jsonObject, this.loading).subscribe(() => {
1912
+ }
1913
+ verifyRepeatExecution() {
1914
+ if (!this.model.repeatExecution) {
1901
1915
  this.poNotification.success('Agendamento realizado com sucesso !');
1902
- });
1903
- if (this.model.repeatExecution) {
1904
- if (this.model.repeatType === 1) {
1905
- this.jsonObject.daily = {
1906
- hour: this.getHourOrMinute(this.model.execAppointHourInit, 'h'),
1907
- minute: this.getHourOrMinute(this.model.execAppointHourInit, 'm')
1908
- };
1909
- }
1910
- if (this.model.repeatType === 2) {
1911
- this.jsonObject.weekly = {
1912
- hour: this.getHourOrMinute(this.model.execAppointHourInit, 'h'),
1913
- minute: this.getHourOrMinute(this.model.execAppointHourInit, 'm'),
1914
- daysOfWeek: this.model.selectWeeklys
1915
- };
1916
+ this.endExecution.emit(this.model);
1917
+ return;
1918
+ }
1919
+ this.createRepeatExecutionParameters();
1920
+ // Executa a diária, semanal ou mensal
1921
+ this.rpwService.createExecution(this.jsonObject, this.loading).subscribe({
1922
+ next: (response) => {
1923
+ this.finishSchedule(false, true, response);
1924
+ },
1925
+ error: () => {
1926
+ this.finishSchedule(false, false, null);
1916
1927
  }
1917
- if (this.model.repeatType === 3) {
1918
- this.jsonObject.monthly = {
1919
- hour: this.getHourOrMinute(this.model.execAppointHourInit, 'h'),
1920
- minute: this.getHourOrMinute(this.model.execAppointHourInit, 'm'),
1921
- day: this.model.dayOfMonth
1922
- };
1928
+ });
1929
+ }
1930
+ createRepeatExecutionParameters() {
1931
+ if (this.model.repeatType === 1) {
1932
+ this.jsonObject.daily = {
1933
+ hour: this.getHourOrMinute(this.model.execAppointHourInit, 'h'),
1934
+ minute: this.getHourOrMinute(this.model.execAppointHourInit, 'm')
1935
+ };
1936
+ }
1937
+ if (this.model.repeatType === 2) {
1938
+ this.jsonObject.weekly = {
1939
+ hour: this.getHourOrMinute(this.model.execAppointHourInit, 'h'),
1940
+ minute: this.getHourOrMinute(this.model.execAppointHourInit, 'm'),
1941
+ daysOfWeek: this.model.selectWeeklys
1942
+ };
1943
+ }
1944
+ if (this.model.repeatType === 3) {
1945
+ this.jsonObject.monthly = {
1946
+ hour: this.getHourOrMinute(this.model.execAppointHourInit, 'h'),
1947
+ minute: this.getHourOrMinute(this.model.execAppointHourInit, 'm'),
1948
+ day: this.model.dayOfMonth
1949
+ };
1950
+ }
1951
+ if (this.isFrenquency()) {
1952
+ this.jsonObject.rangeExecutions = {
1953
+ frequency: {
1954
+ type: this.model.frequencyType,
1955
+ value: this.model.frequencyValue
1956
+ },
1957
+ rangeLimit: {
1958
+ hour: this.getHourOrMinute(this.model.execAppointHourFinal, 'h'),
1959
+ minute: this.getHourOrMinute(this.model.execAppointHourFinal, 'm')
1960
+ }
1961
+ };
1962
+ }
1963
+ }
1964
+ finishSchedule(firstSchedure, isOK, response) {
1965
+ if (!isOK) {
1966
+ this.endExecution.emit(this.model);
1967
+ return;
1968
+ }
1969
+ if (!response['jobScheduleID']) {
1970
+ if (firstSchedure) {
1971
+ this.verifyRepeatExecution();
1923
1972
  }
1924
- if (this.isFrenquency()) {
1925
- this.jsonObject.rangeExecutions = {
1926
- frequency: {
1927
- type: this.model.frequencyType,
1928
- value: this.model.frequencyValue
1929
- },
1930
- rangeLimit: {
1931
- hour: this.getHourOrMinute(this.model.execAppointHourFinal, 'h'),
1932
- minute: this.getHourOrMinute(this.model.execAppointHourFinal, 'm')
1933
- }
1934
- };
1973
+ else {
1974
+ this.poNotification.success('Agendamento realizado com sucesso !');
1975
+ this.endExecution.emit(this.model);
1935
1976
  }
1936
- // Executa a diária, semanal ou mensal
1937
- this.rpwService.createExecution(this.jsonObject, this.loading).subscribe(() => {
1938
- });
1977
+ return;
1939
1978
  }
1940
- this.endExecution.emit(this.model);
1979
+ this.rpwService.getExecutionByJobScheduleID(response['jobScheduleID'], this.loading).subscribe({
1980
+ next: (response) => {
1981
+ if (response) {
1982
+ this.model.listExecutionID.push(response.executionID);
1983
+ }
1984
+ if (firstSchedure) {
1985
+ this.verifyRepeatExecution();
1986
+ }
1987
+ else {
1988
+ this.poNotification.success('Agendamento realizado com sucesso !');
1989
+ this.endExecution.emit(this.model);
1990
+ }
1991
+ },
1992
+ error: () => {
1993
+ if (firstSchedure) {
1994
+ this.verifyRepeatExecution();
1995
+ }
1996
+ }
1997
+ });
1941
1998
  }
1942
1999
  getHourOrMinute(value, type) {
1943
2000
  if (type === 'h') {