Files
doneit-web/src/app/Rules/despacho.service.ts
T

157 lines
3.4 KiB
TypeScript
Raw Normal View History

2021-07-27 21:19:09 +01:00
import { Injectable } from '@angular/core';
2021-08-05 11:47:09 +01:00
import { PermissionService } from '../OtherService/permission.service';
2021-07-27 21:19:09 +01:00
import { ProcessesService } from '../services/processes.service';
@Injectable({
providedIn: 'root'
})
2021-07-30 22:03:48 +01:00
export class DespachoService {
2021-07-27 21:19:09 +01:00
/**
* @description para terminar o
* 95 - signfica
* 98 - significa
*/
ActionTypeId: 95 | 98
action: "Arquivo" | "Reencaminhar"
2021-08-05 16:59:17 +01:00
actions: {
'Tarefa do Despacho': 'Tarefa de Despacho' | 'Concluir' | 'rexecucao'
}
2021-07-30 22:03:48 +01:00
constructor(
2021-07-27 21:19:09 +01:00
private processes: ProcessesService,
2021-08-05 11:47:09 +01:00
public p: PermissionService
2021-07-30 22:03:48 +01:00
) { }
2021-07-27 21:19:09 +01:00
arquivar(note:string, documents:any, serialnumber) {
2021-07-29 15:40:24 +01:00
2021-07-27 21:19:09 +01:00
let body = {
"serialNumber": serialnumber,
"action": "Arquivo",
"ActionTypeId": 95,
"dataFields": {
"ReviewUserComment": note,
},
"AttachmentList" :documents,
}
2021-07-28 14:18:02 +01:00
2021-07-27 21:19:09 +01:00
return this.processes.CompleteTask(body)
}
2021-07-30 22:03:48 +01:00
2021-08-05 16:59:17 +01:00
// reencaminhar(note:string, documents:any, serialnumber) {
2021-07-27 21:19:09 +01:00
2021-08-05 16:59:17 +01:00
// let body = {
// "serialNumber": serialnumber,
// "action": "Reencaminhar",
// "ActionTypeId": 98,
// "dataFields": {
// "ReviewUserComment": note,
// },
// "AttachmentList" :documents,
// }
// return this.processes.CompleteTask(body)
// }
executado(note:string, documents:any , serialnumber) {
2021-07-27 21:19:09 +01:00
let body = {
"serialNumber": serialnumber,
2021-08-05 16:59:17 +01:00
"action": "Conhecimento",
"ActionTypeId": 104,
2021-07-27 21:19:09 +01:00
"dataFields": {
"ReviewUserComment": note,
},
"AttachmentList" :documents,
}
2021-08-05 16:59:17 +01:00
2021-07-27 21:19:09 +01:00
return this.processes.CompleteTask(body)
}
2021-08-05 16:59:17 +01:00
solicitarParecer(task) {
// let body = {
// "serialNumber": serialnumber,
// "action": "Conhecimento",
// "ActionTypeId": 92,
// "dataFields": {
// "ReviewUserComment": note,
// },
// "AttachmentList" :documents,
// }
}
EfectuarDespacho(task) {
// let body = {
// "serialNumber": serialnumber,
// "action": "Conhecimento",
// "ActionTypeId": 94,
// "dataFields": {
// "ReviewUserComment": note,
// },
// "AttachmentList" :documents,
// }
}
rexecucao({note, documents, serialnumber}) {
2021-07-27 21:19:09 +01:00
let body = {
"serialNumber": serialnumber,
2021-08-05 16:59:17 +01:00
"action": "Reexecução",
"ActionTypeId": 100000010,
2021-07-27 21:19:09 +01:00
"dataFields": {
"ReviewUserComment": note,
},
"AttachmentList" :documents,
}
return this.processes.CompleteTask(body)
}
2021-07-30 22:03:48 +01:00
2021-08-05 11:47:09 +01:00
CompleteTask({serialNumber}) {
const body = {
"serialNumber": serialNumber,
"action": "Despacho",
"ActionTypeId": 94,
"dataFields": {
"ReviewUserComment": '',
},
"AttachmentList" :null,
}
return this.processes.CompleteTask(body)
}
2021-07-27 21:26:31 +01:00
2021-08-05 16:08:49 +01:00
Finalizar({serialNumber}) {
const body = {
"serialNumber": serialNumber,
"action": "Conhecimento",
"ActionTypeId": 104,
"dataFields": {
"ReviewUserComment": '',
},
"AttachmentList" :null,
}
}
2021-08-05 11:47:09 +01:00
sendExpedienteToPending(serialnumber) {
2021-07-27 21:26:31 +01:00
return this.processes.SetTaskToPending(serialnumber)
}
2021-08-05 11:47:09 +01:00
/**
* @param body any
* @returns promise
* @description for both profile PR and MDGPR
*/
createDespacho(body: any) {
if(this.p.userRole(['PR'])) {
return this.processes.postDespatchoPr(body)
} else {
return this.processes.postDespatcho(body)
}
}
2021-07-27 21:19:09 +01:00
}