DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `stock`.`buy_addPick`(
	vSelf INT,
	vSource ENUM('buy', 'sale', 'orderRow'),
	vPickFk INT,
	vQuantity INT
)
BEGIN
	INSERT INTO buyPick
		SET
			buyFk = vSelf,
			source = vSource,
			pickFk = vPickFk,
			quantity = vQuantity
		ON DUPLICATE KEY UPDATE
			quantity = quantity + vQuantity;
END$$
DELIMITER ;
