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`.`expeditionPallet_printLabel`(vSelf INT)
|
2024-01-15 11:31:03 +00:00
|
|
|
BEGIN
|
|
|
|
/**
|
|
|
|
* Calls the report_print procedure and passes it
|
|
|
|
* the necessary parameters for printing.
|
|
|
|
*
|
|
|
|
* @param vSelf expeditioPallet id.
|
|
|
|
*/
|
|
|
|
DECLARE vPrinterFk INT;
|
|
|
|
DECLARE vUserFk INT DEFAULT account.myUser_getId();
|
2024-06-27 11:20:52 +00:00
|
|
|
DECLARE vIsInExpeditionPallet BOOL;
|
|
|
|
|
|
|
|
SELECT COUNT(id) INTO vIsInExpeditionPallet
|
|
|
|
FROM expeditionPallet
|
|
|
|
WHERE id = vSelf;
|
|
|
|
|
|
|
|
IF NOT vIsInExpeditionPallet THEN
|
|
|
|
CALL util.throw("ExpeditionPallet not exists");
|
|
|
|
END IF;
|
|
|
|
|
2024-01-15 11:31:03 +00:00
|
|
|
SELECT o.labelerFk INTO vPrinterFk
|
|
|
|
FROM operator o
|
|
|
|
WHERE o.workerFk = vUserFk;
|
|
|
|
|
|
|
|
CALL vn.report_print(
|
|
|
|
'LabelPalletExpedition',
|
|
|
|
vPrinterFk,
|
|
|
|
account.myUser_getId(),
|
|
|
|
JSON_OBJECT('palletFk', vSelf, 'userFk', vUserFk),
|
|
|
|
'high'
|
|
|
|
);
|
|
|
|
|
|
|
|
UPDATE vn.expeditionPallet
|
|
|
|
SET isPrint = TRUE
|
|
|
|
WHERE id = vSelf;
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|