diff --git a/db/routines/vn/procedures/itemShelvingLog_get.sql b/db/routines/vn/procedures/itemShelvingLog_get.sql index f72a31a9b..ad67ea5cd 100644 --- a/db/routines/vn/procedures/itemShelvingLog_get.sql +++ b/db/routines/vn/procedures/itemShelvingLog_get.sql @@ -1,37 +1,35 @@ DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelvingLog_get`( - vShelvingFk VARCHAR(10), - vRecords INT -) +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelvingLog_get`(vShelvingFk VARCHAR(10) ) BEGIN + /** * Devuelve el log de los item en cada carro * - * @param vShelvingFk Matrícula del carro - * @param vRecords Límite de registros retornados + * @param vShelvingFk Matrícula del carro * */ - DECLARE vQuery TEXT; - SET vQuery = ' - SELECT isl.itemFk, - i.longName, - isl.shelvingFk, - w.code, - isl.accion, - isl.quantity, - isl.created - FROM item i - JOIN itemShelvingLog isl ON i.id = isl.itemFk - JOIN worker w ON isl.workerFk = w.id - WHERE shelvingFk = ? - OR isl.itemFk = ? - ORDER BY isl.created DESC'; - - IF vRecords IS NOT NULL THEN - SET vQuery = CONCAT(vQuery, '\nLIMIT ', vRecords); - END IF; - - EXECUTE IMMEDIATE vQuery - USING vShelvingFk, vShelvingFk; + + SELECT isl.itemShelvingFk, + isl.created, + isl.accion, + isl.itemFk, + isl.shelvingFk, + isl.quantity, + isl.visible, + isl.available, + isl.grouping, + isl.packing, + isl.stars, + item.longName, + item.size, + item.subName, + worker.code, + isl.accion + FROM item + JOIN itemShelvingLog isl ON item.id = isl.itemFk + JOIN worker ON isl.workerFk = worker.id + WHERE shelvingFk = vShelvingFk OR isl.itemFk = vShelvingFk + ORDER BY isl.created DESC; + END$$ DELIMITER ;