This commit is contained in:
tiago.kayaya
2021-09-06 12:14:21 +01:00
parent ab0bbf2efd
commit 64fb8f42a1
2 changed files with 74 additions and 42 deletions
+35 -4
View File
@@ -77,8 +77,22 @@ export class DespachoService {
return this.processes.CompleteTask(body) return this.processes.CompleteTask(body)
} }
solicitarParecer({note ='', documents = [], serialnumber}) { solicitarParecer({note ='', documents = [], serialnumber, activityInstanceName}) {
let body = { let body;
if(activityInstanceName == 'Concluir Despacho' || activityInstanceName == 'Concluir Parecer' || activityInstanceName == 'Concluir Deferimento'){
body = {
"serialNumber": serialnumber,
"action": "Parecer",
"ActionTypeId": 92,
"dataFields": {
"ReviewUserComment": note,
},
"AttachmentList" :documents,
}
}
else{
body = {
"serialNumber": serialnumber, "serialNumber": serialnumber,
"action": "Conhecimento", "action": "Conhecimento",
"ActionTypeId": 92, "ActionTypeId": 92,
@@ -88,11 +102,26 @@ export class DespachoService {
"AttachmentList" :documents, "AttachmentList" :documents,
} }
}
return this.processes.CompleteTask(body) return this.processes.CompleteTask(body)
} }
EfectuarDespacho({note = '', documents = [], serialnumber}) { EfectuarDespacho({note = '', documents = [], serialnumber, activityInstanceName}) {
let body = { let body;
if(activityInstanceName == 'Concluir Despacho' || activityInstanceName == 'Concluir Parecer' || activityInstanceName == 'Concluir Deferimento'){
body = {
"serialNumber": serialnumber,
"action": "Despacho",
"ActionTypeId": 94,
"dataFields": {
"ReviewUserComment": note,
},
"AttachmentList" :documents,
}
}
else{
body = {
"serialNumber": serialnumber, "serialNumber": serialnumber,
"action": "Conhecimento", "action": "Conhecimento",
"ActionTypeId": 94, "ActionTypeId": 94,
@@ -101,6 +130,8 @@ export class DespachoService {
}, },
"AttachmentList" :documents, "AttachmentList" :documents,
} }
}
console.log(body);
return this.processes.CompleteTask(body) return this.processes.CompleteTask(body)
} }
@@ -279,10 +279,11 @@ export class CreateProcessPage implements OnInit {
DispatchFolder: this.dispatchFolder, DispatchFolder: this.dispatchFolder,
} }
console.log('this.postData', this.postData, this.taskType); console.log('this.postData', this.postData, this.taskType);
console.log(this.task.activityInstanceName);
try { try {
await this.processes.postDespatcho(this.postData).toPromise(); await this.processes.postDespatcho(this.postData).toPromise();
await this.despachoService.EfectuarDespacho({serialnumber: this.task.serialNumber}).toPromise(); await this.despachoService.EfectuarDespacho({serialnumber: this.task.serialNumber, activityInstanceName: this.task.activityInstanceName}).toPromise();
this.modalController.dismiss(); this.modalController.dismiss();
} catch (error) { } catch (error) {
@@ -307,7 +308,7 @@ export class CreateProcessPage implements OnInit {
try { try {
if(this.task.activityInstanceName == 'Tarefa de Despacho' || this.task.activityInstanceName == 'Reexecutar Despacho') { if(this.task.activityInstanceName == 'Tarefa de Despacho' || this.task.activityInstanceName == 'Reexecutar Despacho') {
await this.despachoService.createParecer(this.postData).toPromise(); await this.despachoService.createParecer(this.postData).toPromise();
await this.despachoService.solicitarParecer({ serialnumber: this.task.serialNumber}).toPromise(); await this.despachoService.solicitarParecer({ serialnumber: this.task.serialNumber, activityInstanceName: this.task.activityInstanceName}).toPromise();
} else { } else {
await this.pedidoService.createParecer(this.postData).toPromise(); await this.pedidoService.createParecer(this.postData).toPromise();
await this.pedidoService.taskCompleteParecer({serialNumber:this.task.serialNumber}).toPromise(); await this.pedidoService.taskCompleteParecer({serialNumber:this.task.serialNumber}).toPromise();
@@ -393,7 +394,7 @@ export class CreateProcessPage implements OnInit {
if(this.task.activityInstanceName == 'Tarefa de Despacho' || this.task.activityInstanceName == 'Reexecutar Despacho') { if(this.task.activityInstanceName == 'Tarefa de Despacho' || this.task.activityInstanceName == 'Reexecutar Despacho') {
await this.despachoService.createParecer(this.postData).toPromise(); await this.despachoService.createParecer(this.postData).toPromise();
await this.despachoService.solicitarParecer({ serialnumber: this.task.serialNumber}).toPromise(); await this.despachoService.solicitarParecer({ serialnumber: this.task.serialNumber, activityInstanceName: this.task.activityInstanceName}).toPromise();
} else { } else {
await this.pedidoService.createParecer(this.postData).toPromise(); await this.pedidoService.createParecer(this.postData).toPromise();
await this.pedidoService.taskCompleteParecer({serialNumber:this.task.serialNumber}).toPromise(); await this.pedidoService.taskCompleteParecer({serialNumber:this.task.serialNumber}).toPromise();