21 lines
458 B
MySQL
21 lines
458 B
MySQL
|
DELIMITER $$
|
||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `stock`.`inbound_removePick`(
|
||
|
vSelf INT,
|
||
|
vOutboundFk INT,
|
||
|
vQuantity INT,
|
||
|
vTotalQuantity INT
|
||
|
)
|
||
|
BEGIN
|
||
|
IF vQuantity < vTotalQuantity THEN
|
||
|
UPDATE inboundPick
|
||
|
SET quantity = quantity - vQuantity
|
||
|
WHERE inboundFk = vSelf
|
||
|
AND outboundFk = vOutboundFk;
|
||
|
ELSE
|
||
|
DELETE FROM inboundPick
|
||
|
WHERE inboundFk = vSelf
|
||
|
AND outboundFk = vOutboundFk;
|
||
|
END IF;
|
||
|
END$$
|
||
|
DELIMITER ;
|