Files
doneit-web/src/app/Rules/despacho.service.ts
T
Peter Maquiran c081a1ac28 Improve
2021-08-05 16:59:17 +01:00

157 lines
3.4 KiB
TypeScript

import { Injectable } from '@angular/core';
import { PermissionService } from '../OtherService/permission.service';
import { ProcessesService } from '../services/processes.service';
@Injectable({
providedIn: 'root'
})
export class DespachoService {
/**
* @description para terminar o
* 95 - signfica
* 98 - significa
*/
ActionTypeId: 95 | 98
action: "Arquivo" | "Reencaminhar"
actions: {
'Tarefa do Despacho': 'Tarefa de Despacho' | 'Concluir' | 'rexecucao'
}
constructor(
private processes: ProcessesService,
public p: PermissionService
) { }
arquivar(note:string, documents:any, serialnumber) {
let body = {
"serialNumber": serialnumber,
"action": "Arquivo",
"ActionTypeId": 95,
"dataFields": {
"ReviewUserComment": note,
},
"AttachmentList" :documents,
}
return this.processes.CompleteTask(body)
}
// reencaminhar(note:string, documents:any, serialnumber) {
// let body = {
// "serialNumber": serialnumber,
// "action": "Reencaminhar",
// "ActionTypeId": 98,
// "dataFields": {
// "ReviewUserComment": note,
// },
// "AttachmentList" :documents,
// }
// return this.processes.CompleteTask(body)
// }
executado(note:string, documents:any , serialnumber) {
let body = {
"serialNumber": serialnumber,
"action": "Conhecimento",
"ActionTypeId": 104,
"dataFields": {
"ReviewUserComment": note,
},
"AttachmentList" :documents,
}
return this.processes.CompleteTask(body)
}
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}) {
let body = {
"serialNumber": serialnumber,
"action": "Reexecução",
"ActionTypeId": 100000010,
"dataFields": {
"ReviewUserComment": note,
},
"AttachmentList" :documents,
}
return this.processes.CompleteTask(body)
}
CompleteTask({serialNumber}) {
const body = {
"serialNumber": serialNumber,
"action": "Despacho",
"ActionTypeId": 94,
"dataFields": {
"ReviewUserComment": '',
},
"AttachmentList" :null,
}
return this.processes.CompleteTask(body)
}
Finalizar({serialNumber}) {
const body = {
"serialNumber": serialNumber,
"action": "Conhecimento",
"ActionTypeId": 104,
"dataFields": {
"ReviewUserComment": '',
},
"AttachmentList" :null,
}
}
sendExpedienteToPending(serialnumber) {
return this.processes.SetTaskToPending(serialnumber)
}
/**
* @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)
}
}
}