6281 feat:buyFk in itemShelving
gitea/salix/pipeline/pr-dev There was a failure building this commit
Details
gitea/salix/pipeline/pr-dev There was a failure building this commit
Details
This commit is contained in:
parent
dd76168bc3
commit
20bf2b73b6
|
@ -1,7 +1,7 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelving_add`(IN vShelvingFk VARCHAR(8), IN vBarcode VARCHAR(22), IN vQuantity INT, IN vPackagingFk VARCHAR(10), IN vGrouping INT, IN vPacking INT, IN vWarehouseFk INT)
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelving_add`(IN vShelvingFk VARCHAR(8), IN vBarcode VARCHAR(22), IN vQuantity INT, IN vPackagingFk VARCHAR(10), IN vGrouping INT, IN vPacking INT, IN vWarehouseFk INT)
|
||||||
BEGIN
|
BEGIN
|
||||||
|
ç
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Añade registro o lo actualiza si ya existe.
|
* Añade registro o lo actualiza si ya existe.
|
||||||
|
@ -18,8 +18,20 @@ BEGIN
|
||||||
DECLARE vItemFk INT;
|
DECLARE vItemFk INT;
|
||||||
DECLARE vBuyFk INT;
|
DECLARE vBuyFk INT;
|
||||||
|
|
||||||
|
SELECT id INTO vBuyFk
|
||||||
|
FROM buy WHERE id = vBarcode;
|
||||||
|
|
||||||
SELECT barcodeToItem(vBarcode) INTO vItemFk;
|
SELECT barcodeToItem(vBarcode) INTO vItemFk;
|
||||||
|
|
||||||
|
IF vBuyFk IS NULL THEN
|
||||||
|
CALL cache.last_buy_refresh(FALSE);
|
||||||
|
|
||||||
|
SELECT buy_id INTO vBuyFk
|
||||||
|
FROM cache.last_buy
|
||||||
|
WHERE item_id = vItemFk
|
||||||
|
AND warehouse_id = vWarehouseFk;
|
||||||
|
END IF;
|
||||||
|
|
||||||
IF vPacking IS NULL
|
IF vPacking IS NULL
|
||||||
THEN
|
THEN
|
||||||
SET vPacking = itemPacking(vBarcode, vWarehouseFk);
|
SET vPacking = itemPacking(vBarcode, vWarehouseFk);
|
||||||
|
@ -29,10 +41,11 @@ BEGIN
|
||||||
IF (SELECT COUNT(*) FROM itemShelving
|
IF (SELECT COUNT(*) FROM itemShelving
|
||||||
WHERE shelvingFk COLLATE utf8_unicode_ci = vShelvingFk
|
WHERE shelvingFk COLLATE utf8_unicode_ci = vShelvingFk
|
||||||
AND itemFk = vItemFk
|
AND itemFk = vItemFk
|
||||||
AND packing = vPacking) = 1 THEN
|
AND packing = vPacking
|
||||||
|
AND buyFk = vBuyFk) THEN
|
||||||
|
|
||||||
UPDATE itemShelving
|
UPDATE itemShelving
|
||||||
SET visible = visible+vQuantity
|
SET visible = visible + vQuantity
|
||||||
WHERE shelvingFk COLLATE utf8_unicode_ci = vShelvingFk AND itemFk = vItemFk AND packing = vPacking;
|
WHERE shelvingFk COLLATE utf8_unicode_ci = vShelvingFk AND itemFk = vItemFk AND packing = vPacking;
|
||||||
|
|
||||||
ELSE
|
ELSE
|
||||||
|
|
Loading…
Reference in New Issue