2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
2024-07-22 09:52:42 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`vn-admin`@`localhost` PROCEDURE `vn`.`ticket_DelayTruck`(vWarehouserFk INT, vHour INT, vMinute INT)
|
2024-01-15 11:31:03 +00:00
|
|
|
BEGIN
|
|
|
|
DECLARE done INT DEFAULT FALSE;
|
|
|
|
DECLARE vTicketFk INT;
|
2024-06-19 09:30:50 +00:00
|
|
|
DECLARE cur1 CURSOR FOR SELECT ticketFk FROM tTicket;
|
2024-01-15 11:31:03 +00:00
|
|
|
|
|
|
|
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
|
|
|
|
|
|
|
|
CALL vn.productionControl(vWarehouserFk,0) ;
|
|
|
|
|
2024-06-19 09:30:50 +00:00
|
|
|
DROP TEMPORARY TABLE IF EXISTS tTicket;
|
|
|
|
CREATE TEMPORARY TABLE tTicket
|
2024-01-15 11:31:03 +00:00
|
|
|
SELECT ticketFk
|
|
|
|
FROM tmp.productionBuffer
|
2024-06-05 06:05:46 +00:00
|
|
|
JOIN alertLevel al ON al.code = 'FREE'
|
2024-01-15 11:31:03 +00:00
|
|
|
WHERE shipped = util.VN_CURDATE()
|
|
|
|
AND problem LIKE '%I:%'
|
|
|
|
AND (HH <= vHour OR HH = vHour AND mm < vMinute)
|
2024-06-05 06:05:46 +00:00
|
|
|
AND alertLevel = al.id;
|
2024-01-15 11:31:03 +00:00
|
|
|
|
|
|
|
OPEN cur1;
|
|
|
|
|
|
|
|
read_loop: LOOP
|
|
|
|
FETCH cur1 INTO vTicketFk;
|
|
|
|
IF done THEN
|
|
|
|
LEAVE read_loop;
|
|
|
|
END IF;
|
|
|
|
|
|
|
|
CALL vn.ticket_DelayTruckSplit(vTicketFk);
|
|
|
|
END LOOP;
|
|
|
|
|
|
|
|
CLOSE cur1;
|
2024-06-19 09:30:50 +00:00
|
|
|
DROP TEMPORARY TABLE tTicket, tmp.productionBuffer;
|
2024-01-15 11:31:03 +00:00
|
|
|
END$$
|
|
|
|
DELIMITER ;
|