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

115 lines
2.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-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-07-27 21:19:09 +01:00
reencaminhar(note:string, documents:any, serialnumber) {
let body = {
"serialNumber": serialnumber,
"action": "Reencaminhar",
"ActionTypeId": 98,
"dataFields": {
"ReviewUserComment": note,
},
"AttachmentList" :documents,
}
return this.processes.CompleteTask(body)
}
2021-07-30 22:03:48 +01:00
2021-07-27 21:26:31 +01:00
executado(note:string, documents:any , serialnumber) {
2021-07-27 21:19:09 +01:00
let body = {
"serialNumber": serialnumber,
"action": "Conhecimento",
"ActionTypeId": 104,
"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
}