refs #5983 test(itemShelving): add getInventory
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
93da129239
commit
9076553070
|
@ -1,52 +1,64 @@
|
||||||
|
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelving_inventory`(vParkingFromFk INT, vParkingToFk INT)
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelving_inventory`(vParkingFromFk VARCHAR(8), vParkingToFk VARCHAR(8))
|
||||||
|
BEGIN
|
||||||
/**
|
/**
|
||||||
* Devuelve un listado de ubicaciones a revisar
|
* Devuelve un listado de ubicaciones a revisar
|
||||||
*
|
*
|
||||||
* @param vParkingFromFk Parking de partida, identificador de vn.parking
|
* @param vParkingFromFk Parking de partida, identificador de parking
|
||||||
* @param vParkingToFk Parking de llegada, identificador de vn.parking
|
* @param vParkingToFk Parking de llegada, identificador de parking
|
||||||
*/
|
*/
|
||||||
|
|
||||||
DECLARE vSectorFk INT;
|
DECLARE vSectorFk INT;
|
||||||
DECLARE vPickingOrderFrom INT;
|
DECLARE vPickingOrderFrom INT;
|
||||||
DECLARE vPickingOrderTo INT;
|
DECLARE vPickingOrderTo INT;
|
||||||
|
|
||||||
SELECT ish.id,
|
|
||||||
p.pickingOrder,
|
|
||||||
p.code parking,
|
|
||||||
ish.shelvingFk,
|
|
||||||
ish.itemFk,
|
|
||||||
i.longName,
|
|
||||||
ish.visible,
|
|
||||||
p.sectorFk,
|
|
||||||
it.workerFk buyer,
|
|
||||||
CONCAT('http:',ic.url, '/catalog/1600x900/',i.image) urlImage,
|
|
||||||
ish.isChecked,
|
|
||||||
CASE
|
|
||||||
WHEN s.notPrepared > sm.parked THEN 0
|
|
||||||
WHEN sm.visible > sm.parked THEN 1
|
|
||||||
ELSE 2
|
|
||||||
END
|
|
||||||
FROM vn.itemShelving ish
|
|
||||||
JOIN vn.item i ON i.id = ish.itemFk
|
|
||||||
JOIN vn.itemType it ON it.id = i.typeFk
|
|
||||||
JOIN tmp.stockMisfit sm ON sm.itemFk = ish.itemFk
|
|
||||||
JOIN vn.shelving sh ON sh.code = ish.shelvingFk
|
|
||||||
JOIN vn.parking p ON p.id = sh.parkingFk
|
|
||||||
JOIN (SELECT s.itemFk, sum(s.quantity) notPrepared
|
|
||||||
FROM vn.sale s
|
|
||||||
JOIN vn.ticket t ON t.id = s.ticketFk
|
|
||||||
JOIN vn.warehouse w ON w.id = t.warehouseFk
|
|
||||||
WHERE t.shipped BETWEEN CURDATE()
|
|
||||||
AND CURDATE() + INTERVAL 23 HOUR
|
|
||||||
AND s.isPicked = FALSE
|
|
||||||
AND w.name = 'Algemesi'
|
|
||||||
GROUP BY s.itemFk) s ON s.itemFk = i.id
|
|
||||||
JOIN hedera.imageConfig ic
|
|
||||||
WHERE p.pickingOrder BETWEEN vParkingFrom AND vPickingOrderTo
|
|
||||||
AND p.sectorFk = vSectorFk
|
|
||||||
ORDER BY p.pickingOrder;
|
|
||||||
|
|
||||||
END ;;
|
SELECT p.sectorFk, p.pickingOrder INTO vSectorFk, vPickingOrderFrom
|
||||||
|
FROM vn.parking p
|
||||||
|
WHERE p.code = vParkingFromFk COLLATE 'utf8mb3_general_ci';
|
||||||
|
|
||||||
|
SELECT p.pickingOrder INTO vPickingOrderTo
|
||||||
|
FROM vn.parking p
|
||||||
|
WHERE p.code = vParkingToFk COLLATE 'utf8mb3_general_ci';
|
||||||
|
|
||||||
|
CALL vn.visible_getMisfit(vSectorFk);
|
||||||
|
|
||||||
|
SELECT ish.id,
|
||||||
|
p.pickingOrder,
|
||||||
|
p.code parking,
|
||||||
|
ish.shelvingFk,
|
||||||
|
ish.itemFk,
|
||||||
|
i.longName,
|
||||||
|
ish.visible,
|
||||||
|
p.sectorFk,
|
||||||
|
it.workerFk buyer,
|
||||||
|
CONCAT('http:',ic.url, '/catalog/1600x900/',i.image) urlImage,
|
||||||
|
ish.isChecked,
|
||||||
|
CASE
|
||||||
|
WHEN s.notPrepared > sm.parked THEN 0
|
||||||
|
WHEN sm.visible > sm.parked THEN 1
|
||||||
|
ELSE 2
|
||||||
|
END priority
|
||||||
|
FROM vn.itemShelving ish
|
||||||
|
JOIN vn.item i ON i.id = ish.itemFk
|
||||||
|
JOIN vn.itemType it ON it.id = i.typeFk
|
||||||
|
JOIN tmp.stockMisfit sm ON sm.itemFk = ish.itemFk
|
||||||
|
JOIN vn.shelving sh ON sh.code = ish.shelvingFk
|
||||||
|
JOIN vn.parking p ON p.id = sh.parkingFk
|
||||||
|
JOIN (SELECT s.itemFk, sum(s.quantity) notPrepared
|
||||||
|
FROM vn.sale s
|
||||||
|
JOIN vn.ticket t ON t.id = s.ticketFk
|
||||||
|
JOIN vn.warehouse w ON w.id = t.warehouseFk
|
||||||
|
JOIN vn.config c ON c.mainWarehouseFk = w.id
|
||||||
|
WHERE t.shipped BETWEEN util.VN_CURDATE()
|
||||||
|
AND util.VN_CURDATE() + INTERVAL 23 HOUR
|
||||||
|
AND s.isPicked = FALSE
|
||||||
|
GROUP BY s.itemFk) s ON s.itemFk = i.id
|
||||||
|
JOIN hedera.imageConfig ic
|
||||||
|
WHERE p.pickingOrder BETWEEN vPickingOrderFrom AND vPickingOrderTo
|
||||||
|
AND p.sectorFk = vSectorFk
|
||||||
|
ORDER BY p.pickingOrder;
|
||||||
|
|
||||||
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ ALTER TABLE `vn`.`ticket` AUTO_INCREMENT = 1;
|
||||||
|
|
||||||
INSERT INTO `salix`.`AccessToken` (`id`, `ttl`, `created`, `userId`)
|
INSERT INTO `salix`.`AccessToken` (`id`, `ttl`, `created`, `userId`)
|
||||||
VALUES
|
VALUES
|
||||||
('DEFAULT_TOKEN', '1209600', util.VN_CURDATE(), 66);
|
('DEFAULT_TOKEN', '1209600', CURDATE(), 66);
|
||||||
|
|
||||||
INSERT INTO `salix`.`printConfig` (`id`, `itRecipient`, `incidencesEmail`)
|
INSERT INTO `salix`.`printConfig` (`id`, `itRecipient`, `incidencesEmail`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -2953,3 +2953,13 @@ INSERT INTO `vn`.`invoiceInSerial` (`code`, `description`, `cplusTerIdNifFk`, `t
|
||||||
('E', 'Midgard', 1, 'CEE'),
|
('E', 'Midgard', 1, 'CEE'),
|
||||||
('R', 'Jotunheim', 1, 'NATIONAL'),
|
('R', 'Jotunheim', 1, 'NATIONAL'),
|
||||||
('W', 'Vanaheim', 1, 'WORLD');
|
('W', 'Vanaheim', 1, 'WORLD');
|
||||||
|
|
||||||
|
|
||||||
|
INSERT INTO `hedera`.`imageConfig` (`id`, `maxSize`, `useXsendfile`, `url`)
|
||||||
|
VALUES
|
||||||
|
(1, 0, 0, 'marvel.com');
|
||||||
|
|
||||||
|
/* DELETE ME */
|
||||||
|
UPDATE vn.config
|
||||||
|
SET mainWarehouseFk=1
|
||||||
|
WHERE id=1;
|
|
@ -7,7 +7,12 @@ describe('itemShelving getInventory()', () => {
|
||||||
let response;
|
let response;
|
||||||
try {
|
try {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
response = await models.ItemShelving.getInventory(1, 2, options);
|
await models.ItemShelving.rawSql(`
|
||||||
|
UPDATE vn.config
|
||||||
|
SET mainWarehouseFk=1
|
||||||
|
WHERE id=1
|
||||||
|
`, null, options);
|
||||||
|
response = await models.ItemShelving.getInventory('100-01', 'LR-02-3', options);
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
|
|
Loading…
Reference in New Issue