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