diff --git a/back/methods/collection/getTickets.js b/back/methods/collection/getTickets.js index 48301a366..693358fb0 100644 --- a/back/methods/collection/getTickets.js +++ b/back/methods/collection/getTickets.js @@ -73,7 +73,7 @@ module.exports = Self => { JOIN item i ON i.id = s.itemFk JOIN itemShelvingSale iss ON iss.saleFk = s.id LEFT JOIN itemShelving ish ON ish.id = iss.itemShelvingFk - LEFT JOIN shelving sh ON sh.code = ish.shelvingFk + LEFT JOIN shelving sh ON sh.id = ish.shelvingFk LEFT JOIN parking p ON p.id = sh.parkingFk LEFT JOIN itemColor ic ON ic.itemFk = s.itemFk LEFT JOIN origin o ON o.id = i.originFk @@ -114,7 +114,7 @@ module.exports = Self => { JOIN item i ON i.id = s.itemFk JOIN itemShelvingSale iss ON iss.saleFk = s.id LEFT JOIN itemShelving ish ON ish.id = iss.itemShelvingFk - LEFT JOIN shelving sh ON sh.code = ish.shelvingFk + LEFT JOIN shelving sh ON sh.id = ish.shelvingFk LEFT JOIN parking p ON p.id = sh.parkingFk LEFT JOIN itemColor ic ON ic.itemFk = s.itemFk LEFT JOIN origin o ON o.id = i.originFk diff --git a/db/routines/vn/procedures/entry_splitByShelving.sql b/db/routines/vn/procedures/entry_splitByShelving.sql index 026c47daa..3201900e6 100644 --- a/db/routines/vn/procedures/entry_splitByShelving.sql +++ b/db/routines/vn/procedures/entry_splitByShelving.sql @@ -1,6 +1,6 @@ DELIMITER $$ CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`entry_splitByShelving`( - vShelvingCode VARCHAR(3), + vShelvingCode VARCHAR(10), vFromEntryFk INT, vToEntryFk INT ) @@ -19,7 +19,7 @@ BEGIN DECLARE vDone BOOLEAN DEFAULT FALSE; DECLARE cur CURSOR FOR - SELECT bb.id buyFk, + SELECT bb.id buyFk, LEAST(bb.stickers, FLOOR(ish.visible / ish.packing)) ishStickers, bb.stickers buyStickers FROM itemShelving ish diff --git a/db/routines/vn/procedures/itemShelvingLog_get.sql b/db/routines/vn/procedures/itemShelvingLog_get.sql index 52e7a273f..de4211e41 100644 --- a/db/routines/vn/procedures/itemShelvingLog_get.sql +++ b/db/routines/vn/procedures/itemShelvingLog_get.sql @@ -1,14 +1,14 @@ DELIMITER $$ -CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelvingLog_get`(vShelvingFk VARCHAR(10) ) +CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelvingLog_get`( + vShelvingFk VARCHAR(10) +) BEGIN - /** * Devuelve el log de los item en cada carro * * @param vShelvingFk MatrĂ­cula del carro * */ - SELECT isl.itemShelvingFk, isl.created, isl.accion, @@ -28,8 +28,9 @@ BEGIN FROM item JOIN itemShelvingLog isl ON item.id = isl.itemFk JOIN worker ON isl.workerFk = worker.id - WHERE shelvingFk = vShelvingFk OR isl.itemFk = vShelvingFk - ORDER BY isl.created DESC; - + JOIN shelving sh ON sh.id = isl.shelvingFk + WHERE sh.code = vShelvingFk COLLATE utf8mb3_unicode_ci + OR isl.itemFk = vShelvingFk -- ?? Respeto porque ya estaba + ORDER BY isl.created DESC; END$$ DELIMITER ; diff --git a/modules/item/back/methods/item-shelving-sale/filter.js b/modules/item/back/methods/item-shelving-sale/filter.js index 01a9f1856..edd04b61f 100644 --- a/modules/item/back/methods/item-shelving-sale/filter.js +++ b/modules/item/back/methods/item-shelving-sale/filter.js @@ -41,7 +41,7 @@ module.exports = Self => { u.name FROM itemShelvingSale iss LEFT JOIN itemShelving ish ON iss.itemShelvingFk = ish.id - LEFT JOIN shelving s ON ish.shelvingFk = s.code + LEFT JOIN shelving s ON ish.shelvingFk = s.id LEFT JOIN parking p ON s.parkingFk = p.id LEFT JOIN account.user u ON u.id = iss.userFk` ); diff --git a/modules/item/back/methods/item-shelving/getListItemNewer.js b/modules/item/back/methods/item-shelving/getListItemNewer.js index 74c73532a..5c4ca277d 100644 --- a/modules/item/back/methods/item-shelving/getListItemNewer.js +++ b/modules/item/back/methods/item-shelving/getListItemNewer.js @@ -45,19 +45,19 @@ module.exports = Self => { WITH tItemShelving AS( SELECT is2.itemFk, is2.created, p.sectorFK, is2.id FROM vn.itemShelving is2 - JOIN vn.shelving sh ON sh.code = is2.shelvingFk + JOIN vn.shelving sh ON sh.id = is2.shelvingFk JOIN vn.parking p ON p.id = sh.parkingFk JOIN vn.sector s ON s.id = p.sectorFk JOIN vn.productionConfig pc - WHERE is2.shelvingFk = ? AND s.code = pc.sectorFromCode + WHERE sh.code = ? AND s.code = pc.sectorFromCode ), tItemInSector AS ( SELECT is2.itemFk, is2.created, is2.shelvingFk FROM vn.itemShelving is2 - JOIN vn.shelving sh ON sh.code = is2.shelvingFk + JOIN vn.shelving sh ON sh.id = is2.shelvingFk JOIN vn.parking p ON p.id = sh.parkingFk JOIN vn.sector s ON s.id = p.sectorFk JOIN vn.productionConfig pc - WHERE is2.shelvingFk <> ? + WHERE sh.code <> ? AND s.code = pc.sectorFromCode) SELECT ti.itemFK, tis.shelvingFk FROM tItemShelving ti diff --git a/modules/item/back/models/item-shelving.json b/modules/item/back/models/item-shelving.json index 5df3b0703..9a0ebc61d 100644 --- a/modules/item/back/models/item-shelving.json +++ b/modules/item/back/models/item-shelving.json @@ -57,8 +57,7 @@ "shelving": { "type": "belongsTo", "model": "Shelving", - "foreignKey": "shelvingFk", - "primaryKey": "code" + "foreignKey": "shelvingFk" } } } \ No newline at end of file