Merge branch 'test' into dev
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
commit
8e34e78964
|
@ -5,28 +5,26 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelving_transf
|
|||
)
|
||||
BEGIN
|
||||
/**
|
||||
* Transfiere producto de una ubicación a otra, fusionando si coincide el
|
||||
* packing y la fecha.
|
||||
* Transfiere producto de una ubicación a otra
|
||||
* fusionando si coincide el packing y la fecha.
|
||||
*
|
||||
* @param vItemShelvingFk Identificador de itemShelving
|
||||
* @param vShelvingFk Identificador de shelving
|
||||
*/
|
||||
DECLARE vNewItemShelvingFk INT DEFAULT 0;
|
||||
DECLARE vNewItemShelvingFk INT;
|
||||
|
||||
SELECT MAX(ish.id)
|
||||
INTO vNewItemShelvingFk
|
||||
SELECT MAX(ish.id) INTO vNewItemShelvingFk
|
||||
FROM itemShelving ish
|
||||
JOIN (
|
||||
SELECT
|
||||
itemFk,
|
||||
packing,
|
||||
created,
|
||||
buyFk
|
||||
SELECT itemFk,
|
||||
packing,
|
||||
created,
|
||||
buyFk
|
||||
FROM itemShelving
|
||||
WHERE id = vItemShelvingFk
|
||||
) ish2 ON ish2.itemFk = ish.itemFk
|
||||
AND ish2.packing = ish.packing
|
||||
AND date(ish2.created) = date(ish.created)
|
||||
AND DATE(ish2.created) = DATE(ish.created)
|
||||
AND ish2.buyFk = ish.buyFk
|
||||
WHERE ish.shelvingFk = vShelvingFk COLLATE utf8_unicode_ci;
|
||||
|
||||
|
@ -39,10 +37,16 @@ BEGIN
|
|||
DELETE FROM itemShelving
|
||||
WHERE id = vItemShelvingFk;
|
||||
ELSE
|
||||
UPDATE itemShelving
|
||||
SET shelvingFk = vShelvingFk
|
||||
WHERE id = vItemShelvingFk;
|
||||
IF (SELECT EXISTS(SELECT id FROM shelving
|
||||
WHERE code = vShelvingFk COLLATE utf8_unicode_ci)) THEN
|
||||
|
||||
UPDATE itemShelving
|
||||
SET shelvingFk = vShelvingFk
|
||||
WHERE id = vItemShelvingFk;
|
||||
ELSE
|
||||
CALL util.throw('The shelving not exists');
|
||||
END IF;
|
||||
END IF;
|
||||
SELECT true;
|
||||
SELECT TRUE;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
DELIMITER ;
|
||||
|
|
Loading…
Reference in New Issue