diff --git a/src/app/modals/create-process/create-process.page.ts b/src/app/modals/create-process/create-process.page.ts index bc2011682..117cf2f25 100644 --- a/src/app/modals/create-process/create-process.page.ts +++ b/src/app/modals/create-process/create-process.page.ts @@ -197,11 +197,10 @@ export class CreateProcessPage implements OnInit { DispatchFolder: this.dispatchFolder, } console.log('this.postData', this.postData, this.taskType); - + try { await this.processes.postDespatcho(this.postData).toPromise(); this.FinalizarDespacho(); - this.toastService.successMessage('Despacho criado'); } catch (error) { this.toastService.badRequest('Processo não efectuado'); } @@ -270,11 +269,12 @@ export class CreateProcessPage implements OnInit { DispatchFolder: this.dispatchFolder, } console.log('this.postData', this.postData, this.taskType); - + + alert('nice !!') try { - await this.processes.postDespatcho(this.postData).toPromise(); + // await this.processes.postDespatcho(this.postData).toPromise(); this.executado(); - this.toastService.successMessage('Despacho criado'); + // this.toastService.successMessage('Despacho criado'); } catch (error) { this.toastService.badRequest('Processo não efectuado'); } @@ -344,8 +344,11 @@ export class CreateProcessPage implements OnInit { async FinalizarDespacho() { - if(this.task.activityInstanceName =='Tarefa de Despacho' || this.task.activityInstanceName =='Reexecutar Despacho'){ - let body = { + let body; + + if(this.task.activityInstanceName =='Tarefa de Despacho' || this.task.activityInstanceName =='Reexecutar Despacho') { + + body = { "serialNumber": this.task.serialNumber, "action": "Conhecimento", "ActionTypeId": 104, @@ -354,10 +357,10 @@ export class CreateProcessPage implements OnInit { }, "AttachmentList" :null, } - await this.processes.CompleteTask(body).toPromise(); } - else if(this.task.activityInstanceName =='Concluir Despacho'){ - let body = { + else if(this.task.activityInstanceName =='Concluir Despacho' || this.task.activityInstanceName == 'Concluir Parecer') { + + body = { "serialNumber": this.task.serialNumber, "action": "Despacho", "ActionTypeId": 94, @@ -366,8 +369,16 @@ export class CreateProcessPage implements OnInit { }, "AttachmentList" :null, } - await this.processes.CompleteTask(body).toPromise(); + } + + try { + await this.processes.CompleteTask(body).toPromise(); + this.toastService.successMessage(''); + } catch (error) { + this.toastService.badRequest('Processo não efectuado'); + } + } async FinalizarParecer() { diff --git a/src/app/pages/gabinete-digital/pedidos/pedido/pedido.page.ts b/src/app/pages/gabinete-digital/pedidos/pedido/pedido.page.ts index 03f585cc5..6b20bd5dc 100644 --- a/src/app/pages/gabinete-digital/pedidos/pedido/pedido.page.ts +++ b/src/app/pages/gabinete-digital/pedidos/pedido/pedido.page.ts @@ -243,7 +243,7 @@ export class PedidoPage implements OnInit { } } - sendExpedienteToPending(){ + sendExpedienteToPending() { this.processes.SetTaskToPending(this.serialnumber).subscribe(res=>{ console.log(res); this.goBack();