39 lines
894 B
SQL
39 lines
894 B
SQL
DELIMITER $$
|
|
CREATE OR REPLACE DEFINER=`vn-admin`@`localhost` PROCEDURE `vn`.`expeditionPallet_printLabel`(vSelf INT)
|
|
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();
|
|
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;
|
|
|
|
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 ;
|