Merge pull request 'refactor: refs #8262 Deprecated inventoryFailure' (!3311) from 8262-byeInventoryFailure into dev
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
Reviewed-on: #3311 Reviewed-by: Carlos Andrés <carlosap@verdnatura.es>
This commit is contained in:
commit
db2a102a88
|
@ -1,48 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`inventoryFailureAdd`()
|
||||
BEGIN
|
||||
|
||||
DECLARE done BOOL DEFAULT FALSE;
|
||||
DECLARE vTicketFk INT;
|
||||
|
||||
DECLARE rs CURSOR FOR
|
||||
SELECT id FROM vn.ticket
|
||||
WHERE shipped = util.yesterday()
|
||||
AND clientFk = 400
|
||||
AND warehouseFk IN (1,44);
|
||||
|
||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
|
||||
|
||||
OPEN rs;
|
||||
|
||||
FETCH rs INTO vTicketFk;
|
||||
|
||||
WHILE NOT done DO
|
||||
|
||||
INSERT INTO vn.inventoryFailure(dated, itemFk, quantity, value, warehouseFk, throwerFk)
|
||||
SELECT t.shipped,
|
||||
s.itemFk,
|
||||
s.quantity,
|
||||
b.buyingValue + b.freightValue + b.packageValue + b.comissionValue,
|
||||
t.warehouseFk,
|
||||
w.id
|
||||
FROM vn.ticket t
|
||||
JOIN vn.sale s ON s.ticketFk = t.id
|
||||
LEFT JOIN cache.last_buy lb ON lb.warehouse_id = t.warehouseFk AND item_id = s.itemFk
|
||||
LEFT JOIN vn.buy b ON b.id = lb.buy_id
|
||||
LEFT JOIN vn.worker w ON w.code = LEFT(s.concept, 3)
|
||||
WHERE t.id = vTicketFk
|
||||
AND s.quantity > 0;
|
||||
|
||||
FETCH rs INTO vTicketFk;
|
||||
|
||||
END WHILE;
|
||||
|
||||
|
||||
CLOSE rs;
|
||||
|
||||
|
||||
|
||||
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -164,10 +164,6 @@ BEGIN
|
|||
SET itemFk = vItemNew
|
||||
WHERE itemFk = vItemOld;
|
||||
|
||||
UPDATE inventoryFailure
|
||||
SET itemFk = vItemNew
|
||||
WHERE itemFk = vItemOld;
|
||||
|
||||
UPDATE genericAllocation
|
||||
SET itemFk = vItemNew
|
||||
WHERE itemFk = vItemOld;
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
RENAME TABLE vn.inventoryFailure TO vn.inventoryFailure__;
|
||||
ALTER TABLE vn.inventoryFailure__ COMMENT='@deprecated 2024-12-16';
|
||||
|
||||
RENAME TABLE vn.inventoryFailureCause TO vn.inventoryFailureCause__;
|
||||
ALTER TABLE vn.inventoryFailureCause__ COMMENT='@deprecated 2024-12-16';
|
Loading…
Reference in New Issue