2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
|
|
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`packingListSwitch`(saleFk INT)
|
|
|
|
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 ;
|