5983_inventory_parking #1677
|
@ -1,52 +1,64 @@
|
|||
|
||||
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
|
||||
*
|
||||
* @param vParkingFromFk Parking de partida, identificador de vn.parking
|
||||
* @param vParkingToFk Parking de llegada, identificador de vn.parking
|
||||
* @param vParkingFromFk Parking de partida, identificador de parking
|
||||
* @param vParkingToFk Parking de llegada, identificador de parking
|
||||
*/
|
||||
|
||||
DECLARE vSectorFk INT;
|
||||
DECLARE vPickingOrderFrom 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;
|
||||
DECLARE vPickingOrderTo INT;
|
||||
|
||||
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
|
||||
jgallego
commented
et convé gastar util.dayEnd torna 23:59:59 et convé gastar util.dayEnd torna 23:59:59
sergiodt
commented
Canviat Canviat
|
||||
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 ;
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ ALTER TABLE `vn`.`ticket` AUTO_INCREMENT = 1;
|
|||
|
||||
INSERT INTO `salix`.`AccessToken` (`id`, `ttl`, `created`, `userId`)
|
||||
VALUES
|
||||
('DEFAULT_TOKEN', '1209600', util.VN_CURDATE(), 66);
|
||||
('DEFAULT_TOKEN', '1209600', CURDATE(), 66);
|
||||
|
||||
INSERT INTO `salix`.`printConfig` (`id`, `itRecipient`, `incidencesEmail`)
|
||||
VALUES
|
||||
|
@ -2953,3 +2953,13 @@ INSERT INTO `vn`.`invoiceInSerial` (`code`, `description`, `cplusTerIdNifFk`, `t
|
|||
('E', 'Midgard', 1, 'CEE'),
|
||||
('R', 'Jotunheim', 1, 'NATIONAL'),
|
||||
('W', 'Vanaheim', 1, 'WORLD');
|
||||
|
||||
|
||||
INSERT INTO `hedera`.`imageConfig` (`id`, `maxSize`, `useXsendfile`, `url`)
|
||||
VALUES
|
||||
(1, 0, 0, 'marvel.com');
|
||||
|
||||
/* DELETE ME */
|
||||
UPDATE vn.config
|
||||
alexm
commented
borrau i el aprove jajaj borrau i el aprove jajaj
sergiodt
commented
Fet Fet
|
||||
SET mainWarehouseFk=1
|
||||
WHERE id=1;
|
|
@ -7,7 +7,12 @@ describe('itemShelving getInventory()', () => {
|
|||
let response;
|
||||
try {
|
||||
const options = {transaction: tx};
|
||||
response = await models.ItemShelving.getInventory(1, 2, options);
|
||||
await models.ItemShelving.rawSql(`
|
||||
jgallego
commented
gastar funcions natives de loopback gastar funcions natives de loopback
alexm
commented
Si, ho vaig pensar, pero no tenim el model config en salix. Per no ficarlo per un camp(id i mainWarehouseFk) Si, ho vaig pensar, pero no tenim el model config en salix. Per no ficarlo per un camp(id i mainWarehouseFk)
|
||||
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();
|
||||
} catch (e) {
|
||||
await tx.rollback();
|
||||
|
|
Loading…
Reference in New Issue
sin vn
Fet