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
+60 -29
View File
@@ -32,7 +32,7 @@ export class DespachoService {
public p: PermissionService,
public LoaderService: LoaderService
) { }
arquivar(note:string, documents:AttachmentList, serialnumber) {
let body = {
@@ -44,10 +44,10 @@ export class DespachoService {
},
"AttachmentList" :documents,
}
return this.processes.CompleteTask(body)
}
// reencaminhar(note:string, documents:any, serialnumber) {
// let body = {
@@ -61,9 +61,9 @@ export class DespachoService {
// }
// return this.processes.CompleteTask(body)
// }
executado(note:string, documents:any , serialnumber) {
let body = {
"serialNumber": serialnumber,
"action": "Conhecimento",
@@ -77,30 +77,61 @@ export class DespachoService {
return this.processes.CompleteTask(body)
}
solicitarParecer({note ='', documents = [], serialnumber}) {
let body = {
"serialNumber": serialnumber,
"action": "Conhecimento",
"ActionTypeId": 92,
"dataFields": {
"ReviewUserComment": note,
},
"AttachmentList" :documents,
solicitarParecer({note ='', documents = [], serialnumber, activityInstanceName}) {
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,
"action": "Conhecimento",
"ActionTypeId": 92,
"dataFields": {
"ReviewUserComment": note,
},
"AttachmentList" :documents,
}
}
return this.processes.CompleteTask(body)
}
EfectuarDespacho({note = '', documents = [], serialnumber}) {
let body = {
"serialNumber": serialnumber,
"action": "Conhecimento",
"ActionTypeId": 94,
"dataFields": {
"ReviewUserComment": note,
},
"AttachmentList" :documents,
EfectuarDespacho({note = '', documents = [], serialnumber, activityInstanceName}) {
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,
"action": "Conhecimento",
"ActionTypeId": 94,
"dataFields": {
"ReviewUserComment": note,
},
"AttachmentList" :documents,
}
}
console.log(body);
return this.processes.CompleteTask(body)
}
@@ -191,13 +222,13 @@ export class DespachoService {
async getList({updateStore = false}): Promise<customTask[]> | null {
if (this.LoaderService.loading) {
return this.despachoStore.list
}
this.LoaderService.push({})
let result: fullTaskList[] = []
let despachoList: customTask[] = [];
@@ -205,18 +236,18 @@ export class DespachoService {
result = await this.processes.GetTasksList("Despacho", false).toPromise();
result = result.filter((data:fullTaskList) => data.workflowInstanceDataFields.Status == "Active")
result.forEach((element, index) => {
let task: customTask = this.customTaskPipe.transform(element);
despachoList.push(task);
});
despachoList = this.sortArrayISODate(despachoList).reverse();
if(updateStore) {
this.despachoStore.reset(despachoList);
}
} catch (error) {
} finally {
@@ -120,7 +120,7 @@ export class CreateProcessPage implements OnInit {
NumberPDPP = this.fulltask.workflowInstanceDataFields.DispatchNumber
}
}
let SourceId;
let SourceType;
let SourceSecFsId;
@@ -230,7 +230,7 @@ export class CreateProcessPage implements OnInit {
this.runValidation()
if(this.Form.invalid) return false
}
if(this.postData.Priority=='99999861') {
this.dispatchFolder.DeadlineType = 'Normal';
@@ -279,15 +279,16 @@ export class CreateProcessPage implements OnInit {
DispatchFolder: this.dispatchFolder,
}
console.log('this.postData', this.postData, this.taskType);
console.log(this.task.activityInstanceName);
try {
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();
} catch (error) {
this.toastService.badRequest('Processo não efectuado');
} finally {
loader.remove()
}
@@ -307,12 +308,12 @@ export class CreateProcessPage implements OnInit {
try {
if(this.task.activityInstanceName == 'Tarefa de Despacho' || this.task.activityInstanceName == 'Reexecutar Despacho') {
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 {
await this.pedidoService.createParecer(this.postData).toPromise();
await this.pedidoService.taskCompleteParecer({serialNumber:this.task.serialNumber}).toPromise();
}
this.modalController.dismiss();
this.toastService.successMessage('Pedido de Parecer enviado');
}
@@ -340,7 +341,7 @@ export class CreateProcessPage implements OnInit {
this.modalController.dismiss();
this.toastService.successMessage('Pedido de Deferimento criado');
}
}
catch (error) {
this.toastService.badRequest('Processo não efectuado');
}
@@ -368,7 +369,7 @@ export class CreateProcessPage implements OnInit {
try {
await this.despachoService.createDespacho(this.postData).toPromise();
await this.despachoService.CompleteTask({serialNumber: this.task.serialNumber}).toPromise();
this.modalController.dismiss();
this.toastService.successMessage('Despacho criado');
} catch (error) {
@@ -393,7 +394,7 @@ export class CreateProcessPage implements OnInit {
if(this.task.activityInstanceName == 'Tarefa de Despacho' || this.task.activityInstanceName == 'Reexecutar Despacho') {
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 {
await this.pedidoService.createParecer(this.postData).toPromise();
await this.pedidoService.taskCompleteParecer({serialNumber:this.task.serialNumber}).toPromise();
@@ -442,7 +443,7 @@ export class CreateProcessPage implements OnInit {
async FinalizarDespacho(loader: HTMLDivElement, message?) {
let body;
if(this.task.activityInstanceName =='Tarefa de Despacho' ||
@@ -461,7 +462,7 @@ export class CreateProcessPage implements OnInit {
else if(this.task.activityInstanceName =='Concluir Despacho' ||
this.task.activityInstanceName == 'Concluir Parecer' ||
this.task.activityInstanceName =='Concluir Deferimento' ||
this.task.activityInstanceName =='Reapreciar Deferimento' ||
this.task.activityInstanceName =='Reapreciar Deferimento' ||
this.task.activityInstanceName == 'Tarefa de Deferimento'
) {
@@ -478,7 +479,7 @@ export class CreateProcessPage implements OnInit {
} else {
console.log('unexpected activityInstanceName', this.task)
}
console.log(body);
try {