feat(WorkerPDA): refs #5926 send to docuware #1617

Merged
alexm merged 10 commits from 5926-signPdaPdf into dev 2025-03-24 06:52:36 +00:00
1 changed files with 28 additions and 36 deletions
Showing only changes of commit 63cf602ab2 - Show all commits

View File

@ -88,48 +88,40 @@ function reloadData() {
async function fetchDocuware() {
loadingDocuware.value = true;
const id = worker.value?.lastName + ' ' + worker.value?.firstName;
const promises = [];
for (const row of tableRef.value.CrudModelRef.formData) {
promises.push(
(async () => {
const { data } = await axios.post(`Docuwares/${id}/checkFile`, {
fileCabinet: 'hr',
signed: false,
mergeFilter: [
{
DBName: 'TIPO_DOCUMENTO',
Value: ['PDA'],
},
{
DBName: 'FILENAME',
Value: [row.deviceProductionFk + '-pda'],
},
],
});
row.docuware = data;
})(),
);
}
const id = `${worker.value?.lastName} ${worker.value?.firstName}`;
const rows = tableRef.value.CrudModelRef.formData;
await Promise.all(promises);
const promises = rows.map(async (row) => {
alexm marked this conversation as resolved
Review

es correcto que esta funcion se ejecute 2 veces al cargar la tabla?

es correcto que esta funcion se ejecute 2 veces al cargar la tabla?
Review

Parece que el @on-fetch se esta activando 2 veces con los mismos datos

Parece que el @on-fetch se esta activando 2 veces con los mismos datos
const { data } = await axios.post(`Docuwares/${id}/checkFile`, {
fileCabinet: 'hr',
signed: false,
mergeFilter: [
{
DBName: 'TIPO_DOCUMENTO',
Value: ['PDA'],
},
{
DBName: 'FILENAME',
Value: [`${row.deviceProductionFk}-pda`],
},
],
});
row.docuware = data;
});
await Promise.allSettled(promises);
loadingDocuware.value = false;
}
async function sendToTablet(rows) {
const promises = [];
for (const row of rows) {
promises.push(
(async () => {
await axios.post(`Docuwares/upload-pda-pdf`, {
ids: [row.deviceProductionFk],
});
row.docuware = true;
})(),
);
}
await Promise.all(promises);
const promises = rows.map(async (row) => {
await axios.post(`Docuwares/upload-pda-pdf`, {
ids: [row.deviceProductionFk],
});
row.docuware = true;
alexm marked this conversation as resolved Outdated

Reemplazar por map

Reemplazar por map
});
await Promise.allSettled(promises);
notify(t('PDF sended to signed'), 'positive');
alexm marked this conversation as resolved
Review

un await pero luego un promises.all?

un await pero luego un promises.all?
tableRef.value.reload();
}