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`.`parking_algemesi`(vFromRow INT, vToRow INT, vSectorFk INT, vLetter VARCHAR(1), vPickingOrder INT, vTrolleysByLine INT)
|
2024-01-15 11:31:03 +00:00
|
|
|
BEGIN
|
|
|
|
|
|
|
|
DECLARE vRow INT;
|
|
|
|
DECLARE vCode VARCHAR(8);
|
|
|
|
DECLARE i INT;
|
|
|
|
|
|
|
|
IF vToRow < vFromRow THEN
|
|
|
|
|
|
|
|
SET vRow = vFromRow;
|
|
|
|
|
|
|
|
WHILE vRow >= vToRow DO
|
|
|
|
|
|
|
|
SET i = 1;
|
|
|
|
|
|
|
|
WHILE i <= vTrolleysByLine DO
|
|
|
|
|
|
|
|
SET vCode = CONCAT(vLetter,'-', LPAD(vRow,2,'0'),'-', i);
|
|
|
|
|
|
|
|
INSERT IGNORE INTO vn.parking( sectorFk, `code`, pickingOrder)
|
|
|
|
VALUES (vSectorFk, vCode, vPickingOrder + (i * 10))
|
|
|
|
ON DUPLICATE KEY UPDATE `code` = vCode;
|
|
|
|
|
|
|
|
SET i = i + 1;
|
|
|
|
|
|
|
|
END WHILE;
|
|
|
|
|
|
|
|
SET vRow = vRow - 1;
|
|
|
|
|
|
|
|
END WHILE;
|
|
|
|
|
|
|
|
ELSE
|
|
|
|
|
|
|
|
SET vRow = vFromRow;
|
|
|
|
|
|
|
|
WHILE vRow <= vToRow DO
|
|
|
|
|
|
|
|
SET i = 1;
|
|
|
|
|
|
|
|
WHILE i <= vTrolleysByLine DO
|
|
|
|
|
|
|
|
SET vCode = CONCAT(vLetter,'-', LPAD(vRow,2,'0'),'-', i);
|
|
|
|
|
|
|
|
INSERT IGNORE INTO vn.parking( sectorFk, `code`, pickingOrder)
|
|
|
|
VALUES (vSectorFk, vCode, vPickingOrder + (i * 10) )
|
|
|
|
ON DUPLICATE KEY UPDATE `code` = vCode;
|
|
|
|
|
|
|
|
SET i = i + 1;
|
|
|
|
|
|
|
|
END WHILE;
|
|
|
|
|
|
|
|
SET vRow = vRow + 1;
|
|
|
|
|
|
|
|
END WHILE;
|
|
|
|
|
|
|
|
|
|
|
|
END IF;
|
|
|
|
|
|
|
|
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|