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`.`travel_updatePacking`(vItemFk INT, vPacking INT)
|
2024-01-15 11:31:03 +00:00
|
|
|
BEGIN
|
|
|
|
/**
|
|
|
|
* Actualiza packing para los movimientos de almacén de la subasta al almacén central
|
|
|
|
*
|
|
|
|
* @param vItemFk id del item
|
|
|
|
* @param vPacking nuevo packing
|
|
|
|
*/
|
|
|
|
|
|
|
|
DECLARE vAuctionWarehouseFk INT;
|
|
|
|
DECLARE vMainWarehouseFk INT;
|
|
|
|
|
|
|
|
SELECT warehouseFk INTO vAuctionWarehouseFk
|
|
|
|
FROM auctionConfig;
|
|
|
|
|
|
|
|
SELECT mainWarehouseFk INTO vMainWarehouseFk
|
|
|
|
FROM config;
|
|
|
|
|
|
|
|
UPDATE entry e
|
|
|
|
JOIN travel t ON t.id = e.travelFk
|
|
|
|
JOIN buy b on b.entryFk = e.id
|
|
|
|
SET b.packing = vPacking
|
|
|
|
WHERE t.shipped >= util.dayEnd(CURDATE())
|
|
|
|
AND t.warehouseInFk = vMainWarehouseFk
|
|
|
|
AND t.warehouseOutFk = vAuctionWarehouseFk
|
|
|
|
AND b.itemFk = vItemFk;
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|