Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | 6x 36x 6x 6x 36x 6x 51x 51x 51x 5x 51x 5x 51x 5x 51x 5x 51x 6x 51x 5x 51x 5x 51x 5x 51x 5x 51x 5x 51x 51x 306x 306x 306x 102x 51x | /* eslint-disable no-param-reassign */ import moment from 'moment-timezone'; import { t } from '../../helpers/i18n'; import storageAddressTypesDao from '../../database/dao/storageAddressType'; import { models } from '../../../config/database'; import { mountWhereBasedFilter } from '../../helpers/reports/sequelize'; // Funcao criada para popular o array headers e rows enviados por parametro export default async function generateData( columns, filters, headers = [], rows = [], opts = {}, appLanguage = 'ptBr' ) { const where = mountWhereBasedFilter(filters); const headersValue = columns.map((it) => it.value); const dados = await storageAddressTypesDao.findStorageAddressTypes(where, { attributes: headersValue, include: [ { required: false, model: models.User, as: 'userCreated', attributes: ['login'], }, { required: false, model: models.User, as: 'userUpdated', attributes: ['login'], }, ], ...opts, }); columns.forEach((it) => { headers.push(it.label); }); dados.forEach((it) => { // usuário de criação it.createdUser = it.userCreated.dataValues.login; // usuário de atualização it.updatedUser = it.userUpdated.dataValues.login; if (it.status === 1) { it.status = `${1} - ${t('BEE733' /* Normal */, undefined, appLanguage)}`; } if (it.status === 2) { it.status = `${2} - ${t( 'BEE734' /* Excedente */, undefined, appLanguage )}`; } if (it.status === 3) { it.status = `${3} - ${t('BEE735' /* Reserva */, undefined, appLanguage)}`; } if (it.status === 4) { it.status = `${4} - ${t('BEE736' /* Picking */, undefined, appLanguage)}`; } if (it.status === 5) { it.status = `${5} - ${t( 'BEE177' /* Rejeitados */, undefined, appLanguage )}`; } if (it.status === 6) { it.status = `${6} - ${t('BEE573' /* Avaria */, undefined, appLanguage)}`; } if (it.status === 7) { it.status = `${7} - ${t('BEE2238' /* Falta */, undefined, appLanguage)}`; } if (it.status === 8) { it.status = `${8} - ${t( 'BEE3495' /* Stage Pré-Armazenagem */, undefined, appLanguage )}`; } if (it.status === 9) { it.status = `${9} - ${t( 'BEE3589' /* Stage de Separação */, undefined, appLanguage )}`; } if (it.status === 10) { it.status = `${10} - ${t( 'BEE4347' /* Cross-Docking */, undefined, appLanguage )}`; } const row = []; for (let index = 0; index < headersValue.length; index++) { const column = headersValue[index]; row.push(it[column]); if (column === 'createdAt' || column === 'updatedAt') { row[index] = moment(row[index]).format('l LTS'); } } rows.push(row); }); } |