23 lines
924 B
SQL
23 lines
924 B
SQL
DELIMITER $$
|
|
CREATE OR REPLACE DEFINER=`vn-admin`@`localhost` PROCEDURE `vn`.`itemShelving_getAlternatives`(vShelvingFk VARCHAR(10))
|
|
BEGIN
|
|
/**
|
|
* Devuelve un listado de posibles ubicaciones alternativas a ubicar los item de la matricula
|
|
* del carro que se le ha pasado.
|
|
*
|
|
* @param vShelvingFk matricula del carro
|
|
*/
|
|
SELECT is2.id,is2.shelvingFk , p.code, is2.itemFk , is2.visible, p.pickingOrder
|
|
FROM itemShelving is2
|
|
JOIN shelving sh ON sh.code = is2.shelvingFk
|
|
JOIN parking p ON p.id = sh.parkingFk
|
|
JOIN sector s ON s.id = p.sectorFk
|
|
LEFT JOIN operator o ON o.sectorFk = s.id AND o.workerFk = account.myUser_getId()
|
|
JOIN warehouse wh ON wh.id = s.warehouseFk
|
|
JOIN itemShelving is3 ON is3.itemFk = is2.itemFk AND is3.shelvingFk = vShelvingFk COLLATE utf8_unicode_ci
|
|
WHERE is2.shelvingFk <> vShelvingFk COLLATE utf8_unicode_ci
|
|
GROUP BY is2.id
|
|
ORDER BY p.pickingOrder DESC;
|
|
END$$
|
|
DELIMITER ;
|