Compare commits

...

5 Commits

Author SHA1 Message Date
Sergio De la torre 664bdc981d Merge branch 'dev' into 7763_rename_itemShelving
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-08-08 15:21:43 +00:00
Sergio De la torre 5a7201a9fd Merge branch 'dev' into 7763_rename_itemShelving
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-08-06 11:48:34 +00:00
Sergio De la torre 3ca64f51a9 feat rename refs #7763
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-08-06 13:47:20 +02:00
Sergio De la torre ff4a35ee2e Merge branch 'dev' into 7763_rename_itemShelving
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-08-06 10:49:40 +00:00
Sergio De la torre 0673e8ea5f feat rename itemShelvingAdd refs #7763
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-07-26 12:49:16 +02:00
1 changed files with 17 additions and 22 deletions

View File

@ -12,45 +12,38 @@ BEGIN
/** /**
* Añade registro o lo actualiza si ya existe. * Añade registro o lo actualiza si ya existe.
* *
* @param vShelvingFk matrícula del carro * @param vShelvingFk Matrícula del carro
* @param vBarcode el id del registro * @param vBarcode El id del registro
* @param vQuantity indica la cantidad del producto * @param vQuantity Indica la cantidad del producto
* @param vPackagingFk el packaging del producto en itemShelving, NULL para coger el de la ultima compra * @param vPackagingFk El packaging, NULL para coger el de la ultima compra
* @param vGrouping el grouping del producto en itemShelving, NULL para coger el de la ultima compra * @param vGrouping El grouping, NULL para coger el de la ultima compra
* @param vPacking el packing del producto, NULL para coger el de la ultima compra * @param vPacking El packing, NULL para coger el de la ultima compra
* @param vWarehouseFk indica el sector * @param vWarehouseFk Indica el sector
* */
**/ DECLARE vItemFk INT DEFAULT barcodeToItem(vBarcode);
DECLARE vItemFk INT; DECLARE vBuyFk INT DEFAULT (SELECT id FROM buy WHERE id = vBarcode);
DECLARE vBuyFk INT;
SELECT id INTO vBuyFk
FROM buy WHERE id = vBarcode;
SELECT barcodeToItem(vBarcode) INTO vItemFk;
IF vBuyFk IS NULL THEN IF vBuyFk IS NULL THEN
CALL util.throw('The buy is required'); CALL util.throw('The buy is required');
END IF; END IF;
IF vPacking IS NULL IF vPacking IS NULL THEN
THEN
SET vPacking = itemPacking(vBarcode, vWarehouseFk); SET vPacking = itemPacking(vBarcode, vWarehouseFk);
SET vQuantity = vQuantity * vPacking; SET vQuantity = vQuantity * vPacking;
END IF; END IF;
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 AND packing = vPacking
AND buyFk = vBuyFk) THEN 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
INSERT INTO itemShelving( INSERT INTO itemShelving(
itemFk, itemFk,
shelvingFk, shelvingFk,
@ -68,6 +61,8 @@ BEGIN
id id
FROM buy b FROM buy b
WHERE id = vBuyFk; WHERE id = vBuyFk;
SELECT LAST_INSERT_ID();
END IF; END IF;
END$$ END$$
DELIMITER ; DELIMITER ;