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`.`packingListSwitch`(saleFk INT)
|
2024-01-15 11:31:03 +00:00
|
|
|
BEGIN
|
|
|
|
|
|
|
|
DECLARE valueFk INT;
|
|
|
|
DECLARE encajando INT DEFAULT 9;
|
|
|
|
|
2024-04-24 07:53:31 +00:00
|
|
|
SELECT isChecked INTO valueFk
|
|
|
|
FROM saleTracking
|
|
|
|
WHERE saleFk = saleFk
|
2024-01-15 11:31:03 +00:00
|
|
|
AND stateFk = encajando;
|
|
|
|
|
|
|
|
SET valueFk = (IFNULL(valueFk,0) + 1) MOD 3;
|
|
|
|
|
2024-04-24 07:53:31 +00:00
|
|
|
REPLACE saleTracking(saleFk, isChecked, workerFk, stateFk)
|
2024-01-15 11:31:03 +00:00
|
|
|
VALUES(saleFk,valueFk,account.myUser_getId(),encajando);
|
|
|
|
|
|
|
|
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|