2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
2024-08-20 08:06:10 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemPlacementSupplyStockGetTargetList`(vItemFk INT,vSectorFk INT)
|
2024-01-15 11:31:03 +00:00
|
|
|
BEGIN
|
|
|
|
/**
|
|
|
|
* Devuelve la lista de ubicaciones para itemFk en ese sector. Se utiliza en la preparación previa.
|
|
|
|
* Este proc se llama a continuacion de ticketToPrePrepare
|
|
|
|
*
|
|
|
|
* @param vItemFk Identificador de vn.item
|
|
|
|
* @param vSectorFk Identificador de vn.sector
|
|
|
|
*/
|
|
|
|
SELECT ish.shelvingFk shelving,
|
2024-01-31 08:38:57 +00:00
|
|
|
p.code parking,
|
2024-02-06 07:05:30 +00:00
|
|
|
SUM(ish.visible) stockTotal,
|
2024-01-31 08:38:57 +00:00
|
|
|
ish.created,
|
|
|
|
p.pickingOrder
|
2024-01-15 11:31:03 +00:00
|
|
|
FROM vn.itemShelving ish
|
|
|
|
JOIN vn.shelving sh ON sh.code = ish.shelvingFk
|
|
|
|
JOIN vn.parking p ON p.id = sh.parkingFk
|
|
|
|
JOIN vn.sector sc ON sc.id = p.sectorFk
|
|
|
|
JOIN vn.warehouse w ON w.id = sc.warehouseFk
|
2024-05-21 07:16:47 +00:00
|
|
|
WHERE ish.visible > 0
|
2024-02-06 07:05:30 +00:00
|
|
|
AND ish.itemFk = vItemFk
|
2024-01-15 11:31:03 +00:00
|
|
|
GROUP BY ish.id
|
2024-05-21 07:16:47 +00:00
|
|
|
ORDER BY
|
2024-05-21 07:37:29 +00:00
|
|
|
(sc.id = vSectorFk) DESC,
|
2024-05-21 07:16:47 +00:00
|
|
|
sh.priority DESC,
|
2024-02-06 07:05:30 +00:00
|
|
|
ish.created,
|
|
|
|
p.pickingOrder;
|
2024-01-15 11:31:03 +00:00
|
|
|
END$$
|
2024-01-31 08:38:57 +00:00
|
|
|
DELIMITER ;
|