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 111 112 | 5x 5x 2x 3x 3x 1x 2x 2x 1x 3x 3x 1x 2x 2x 1x 2x 2x 1x 6x 6x 1x 5x 1x 4x 1x 3x 3x 1x 2x 1x | import moment from 'moment-timezone'; import APIError from '../helpers/error'; import { t } from '../helpers/i18n'; import OutboundOrderInformation from '../source/outboundOrders/information'; import OutboundOrderProductInformation from '../source/outboundOrderProducts/information'; function validOutboundOrderCheckList(req) { const { startDate, endDate } = req.query; if (!startDate || !endDate) { throw new APIError( 'DATE_MISSING', t('BEE1212' /* Não foi informada a data inicial ou final */) ); } const validStartDate = moment(startDate).isValid(); if (!validStartDate) { throw new APIError( 'INVALID_START_DATE', t('BEE1213' /* A data inicial informada não é válida */) ); } const validEndDate = moment(endDate).isValid(); if (!validEndDate) { throw new APIError( 'INVALID_END_DATE', t('BEE1214' /* A data final informada não é válida */) ); } } async function validOutboundOrderCheckOrder(req) { const { id } = req.query; if (!id) throw new APIError( 'MISSING_ORDER_ID', t('BEE1215' /* ID do pedido de saída não informado */) ); const outboundOrder = await OutboundOrderInformation.getOutboundOrder( { id, }, { userBranches: req.userBranches } ); if (!outboundOrder) throw new APIError( 'INVALID_ORDER_ID', t('BEE1216' /* Pedido de saída não localizado com o ID informado */) ); } async function validOutboundOrderByNumber(req) { const { orderNumber } = req.query; if (!orderNumber) throw new APIError( 'ORDER_NUMBER_REQUIRED', t('BEE1217' /* O número do pedido de saída não informado */) ); } async function validConfirmCheck(req) { const { outboundOrderProductId, outboundOrderId, checkedQuantity } = req.body; if (!outboundOrderProductId) throw new APIError( 'PRODUCT_ID_REQUIRED', t('BEE1218' /* ID do produto não informado */) ); if (!outboundOrderId) throw new APIError( 'ORDER_ID_REQUIRED', t('BEE1215' /* ID do pedido de saída não informado */) ); if (!checkedQuantity) throw new APIError( 'CHECKED_QUANTITY_REQUIRED', t('BEE1219' /* Quantidade conferida não informado */) ); const outboundOrderProduct = await OutboundOrderProductInformation.getOutboundOrderProduct( { id: outboundOrderProductId, }, { userBranches: req.userBranches } ); if (!outboundOrderProduct) throw new APIError( 'PRODUCT_NOT_FOUND', t('BEE1205' /* Produto não encontrado */) ); if (outboundOrderProduct.checked) throw new APIError( 'PRODUCT_ALREADY_PICKED', t('BEE1220' /* Produto já separado */) ); } export default { validOutboundOrderCheckList, validOutboundOrderCheckOrder, validOutboundOrderByNumber, validConfirmCheck, }; |