dts-backoffice-util 19.1.1 → 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.1.1 |
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
 
@@ -519,16 +519,26 @@ class DisclaimerUtil {
519
519
  value: `${value}`
520
520
  };
521
521
  }
522
- makeDisclaimerFromNumber(property, value, hideClose = false, vldBlank = false) {
522
+ makeDisclaimerFromNumber(property, value, hideClose = false, vldBlank = false, options = new Array()) {
523
+ let opt = null;
524
+ let label = '';
523
525
  if (value === null || value === undefined) {
524
526
  return { label: '', property: '', value: '' };
525
527
  }
526
528
  if (vldBlank && value === 0) {
527
529
  return { label: '', property: '', value: '' };
528
530
  }
531
+ label = `${this.literals[property]}:`;
532
+ if (options && options.length > 0) {
533
+ opt = options.find(itOpt => itOpt.value === value);
534
+ label = `${label} ${opt ? opt.label : value}`;
535
+ }
536
+ else {
537
+ label = `${label} ${value}`;
538
+ }
529
539
  return {
530
540
  hideClose,
531
- label: `${this.literals[property]}: ${value}`,
541
+ label: `${label}`,
532
542
  property: `${property}`,
533
543
  value: `${value}`
534
544
  };
@@ -1846,6 +1856,19 @@ class TotvsScheduleExecutionComponent {
1846
1856
  if (!this.validate()) {
1847
1857
  return;
1848
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() {
1849
1872
  let idxParam;
1850
1873
  this.jsonObject = {};
1851
1874
  this.jsonObject.status = 'active';
@@ -1886,48 +1909,92 @@ class TotvsScheduleExecutionComponent {
1886
1909
  this.jsonObject.executionParameter.parametros[idxParam] = {};
1887
1910
  this.jsonObject.executionParameter.parametros[idxParam].selecoes = this.paramSelections;
1888
1911
  }
1889
- // Executa hoje ou agendada
1890
- this.rpwService.createExecution(this.jsonObject, this.loading).subscribe(() => {
1912
+ }
1913
+ verifyRepeatExecution() {
1914
+ if (!this.model.repeatExecution) {
1891
1915
  this.poNotification.success('Agendamento realizado com sucesso !');
1892
- });
1893
- if (this.model.repeatExecution) {
1894
- if (this.model.repeatType === 1) {
1895
- this.jsonObject.daily = {
1896
- hour: this.getHourOrMinute(this.model.execAppointHourInit, 'h'),
1897
- minute: this.getHourOrMinute(this.model.execAppointHourInit, 'm')
1898
- };
1899
- }
1900
- if (this.model.repeatType === 2) {
1901
- this.jsonObject.weekly = {
1902
- hour: this.getHourOrMinute(this.model.execAppointHourInit, 'h'),
1903
- minute: this.getHourOrMinute(this.model.execAppointHourInit, 'm'),
1904
- daysOfWeek: this.model.selectWeeklys
1905
- };
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);
1906
1927
  }
1907
- if (this.model.repeatType === 3) {
1908
- this.jsonObject.monthly = {
1909
- hour: this.getHourOrMinute(this.model.execAppointHourInit, 'h'),
1910
- minute: this.getHourOrMinute(this.model.execAppointHourInit, 'm'),
1911
- day: this.model.dayOfMonth
1912
- };
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();
1913
1972
  }
1914
- if (this.isFrenquency()) {
1915
- this.jsonObject.rangeExecutions = {
1916
- frequency: {
1917
- type: this.model.frequencyType,
1918
- value: this.model.frequencyValue
1919
- },
1920
- rangeLimit: {
1921
- hour: this.getHourOrMinute(this.model.execAppointHourFinal, 'h'),
1922
- minute: this.getHourOrMinute(this.model.execAppointHourFinal, 'm')
1923
- }
1924
- };
1973
+ else {
1974
+ this.poNotification.success('Agendamento realizado com sucesso !');
1975
+ this.endExecution.emit(this.model);
1925
1976
  }
1926
- // Executa a diária, semanal ou mensal
1927
- this.rpwService.createExecution(this.jsonObject, this.loading).subscribe(() => {
1928
- });
1977
+ return;
1929
1978
  }
1930
- 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
+ });
1931
1998
  }
1932
1999
  getHourOrMinute(value, type) {
1933
2000
  if (type === 'h') {