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`.`collection_printSticker`(
|
2024-01-15 11:31:03 +00:00
|
|
|
vSelf INT,
|
|
|
|
vLabelCount INT
|
|
|
|
)
|
|
|
|
BEGIN
|
|
|
|
/**
|
|
|
|
* Prints a yellow label from a collection or a ticket
|
|
|
|
*
|
|
|
|
* @param vSelf collection or ticket
|
|
|
|
* @param vLabelCount number of times the collection has been printed
|
|
|
|
*/
|
|
|
|
DECLARE vPrintArgs JSON DEFAULT JSON_OBJECT('collectionOrTicketFk', vSelf);
|
|
|
|
|
|
|
|
IF vLabelCount IS NULL THEN
|
|
|
|
INSERT INTO ticketTrolley
|
|
|
|
SELECT ticketFk, 1
|
|
|
|
FROM ticketCollection
|
|
|
|
WHERE collectionFk = vSelf
|
|
|
|
ON DUPLICATE KEY UPDATE labelCount = labelCount + 1;
|
|
|
|
ELSE
|
|
|
|
SET vPrintArgs = JSON_MERGE_PATCH(vPrintArgs, JSON_OBJECT('labelCount', vLabelCount));
|
|
|
|
END IF;
|
|
|
|
|
|
|
|
CALL report_print(
|
|
|
|
'LabelCollection',
|
|
|
|
(SELECT o.labelerFk FROM operator o WHERE o.workerFk = account.myUser_getId()),
|
|
|
|
account.myUser_getId(),
|
|
|
|
vPrintArgs,
|
|
|
|
'high'
|
|
|
|
);
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|