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`.`itemPlacementSupplyAiming`(vShelvingFk VARCHAR(10), quantity INT, vItemFk INT)
|
2024-01-15 11:31:03 +00:00
|
|
|
BEGIN
|
|
|
|
|
|
|
|
SELECT ish.itemFk,
|
|
|
|
ish.longName,
|
|
|
|
ish.size,
|
|
|
|
ish.subName,
|
|
|
|
ish.itemShelvingFk,
|
|
|
|
ish.shelving,
|
|
|
|
ish.stock,
|
|
|
|
LEAST(ish.stock,quantity) as total,
|
|
|
|
CONCAT(
|
|
|
|
CAST(FLOOR(LEAST(ish.stock,quantity) / ish.packing) AS DECIMAL(10,0)),
|
|
|
|
' x ',
|
|
|
|
ish.packing,
|
|
|
|
IF (
|
|
|
|
LEAST(ish.stock,quantity) MOD ish.packing,
|
|
|
|
CONCAT(' + ',CAST(LEAST(ish.stock,quantity) MOD ish.packing AS DECIMAL(10,0))),
|
|
|
|
''
|
|
|
|
),
|
|
|
|
' = ',
|
|
|
|
LEAST(ish.stock,quantity)
|
|
|
|
) as proposal
|
|
|
|
FROM vn.itemShelvingPlacementSupplyStock ish
|
|
|
|
WHERE ish.shelving = vShelvingFk COLLATE utf8_general_ci
|
|
|
|
AND ish.itemFk = vItemFk;
|
|
|
|
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|