2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
2024-01-25 16:33:54 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `edi`.`supplyResponse_afterUpdate`
|
2024-01-15 11:31:03 +00:00
|
|
|
AFTER UPDATE ON `supplyResponse`
|
|
|
|
FOR EACH ROW
|
|
|
|
BEGIN
|
|
|
|
|
|
|
|
UPDATE vn.buy b
|
|
|
|
JOIN vn.entry e ON e.id = b.entryFk
|
|
|
|
JOIN vn.travel tr ON tr.id = e.travelFk
|
|
|
|
JOIN vn.agencyMode am ON am.id = tr.agencyModeFk
|
|
|
|
JOIN vn.item i ON i.id = b.itemFk
|
|
|
|
JOIN edi.supplyResponse sr ON i.supplyResponseFk = sr.ID
|
|
|
|
SET b.quantity = NEW.NumberOfItemsPerCask * NEW.NumberOfUnits,
|
|
|
|
b.stickers = NEW.NumberOfUnits
|
|
|
|
WHERE i.supplyResponseFk = NEW.ID
|
|
|
|
AND am.name = 'LOGIFLORA'
|
|
|
|
AND e.isRaid
|
|
|
|
AND tr.landed >= util.VN_CURDATE();
|
|
|
|
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|