23 lines
489 B
MySQL
23 lines
489 B
MySQL
|
DELIMITER $$
|
||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `stock`.`outbound_afterDelete`
|
||
|
AFTER DELETE ON `outbound`
|
||
|
FOR EACH ROW
|
||
|
BEGIN
|
||
|
UPDATE inbound i
|
||
|
JOIN inboundPick ou ON ou.inboundFk = i.id
|
||
|
SET i.available = i.available + ou.quantity,
|
||
|
i.isSync = FALSE
|
||
|
WHERE ou.outboundFk = OLD.id;
|
||
|
|
||
|
DELETE FROM inboundPick
|
||
|
WHERE outboundFk = OLD.id;
|
||
|
|
||
|
CALL visible_log(
|
||
|
OLD.isPicked,
|
||
|
OLD.warehouseFk,
|
||
|
OLD.itemFk,
|
||
|
OLD.quantity
|
||
|
);
|
||
|
END$$
|
||
|
DELIMITER ;
|