8144-devToTest_2448 #3216
|
@ -1,11 +1,10 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`shelvingChange`(IN `vShelvingO` VARCHAR(8), IN `vShelvingD` VARCHAR(8))
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`shelvingChange`(IN `vShelvingO` VARCHAR(8), IN `vShelvingD` VARCHAR(8))
|
||||||
BEGIN
|
BEGIN
|
||||||
|
UPDATE itemShelving ish
|
||||||
UPDATE vn.itemShelving
|
JOIN shelving sh1 ON sh1.code = vShelvingD COLLATE utf8_unicode_ci
|
||||||
SET shelvingFk = vShelvingD COLLATE utf8_unicode_ci
|
JOIN shelving sh2 ON sh2.code = vShelvingO COLLATE utf8_unicode_ci
|
||||||
WHERE shelvingFk = vShelvingO COLLATE utf8_unicode_ci;
|
SET ish.shelvingFk = sh1.id
|
||||||
|
WHERE ish.shelvingFk = sh2.id;
|
||||||
|
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`shelvingParking_get`(vShelvingFk VARCHAR(10), vWarehouseFk INT, vDayRange INT)
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`shelvingParking_get`(
|
||||||
|
vShelvingCode VARCHAR(10),
|
||||||
|
vWarehouseFk INT,
|
||||||
|
vDayRange INT
|
||||||
|
)
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|
||||||
|
|
||||||
SELECT s.itemFk,
|
SELECT s.itemFk,
|
||||||
s.concept,
|
s.concept,
|
||||||
CAST(SUM(s.quantity) AS DECIMAL(10,0)) as sinServir,
|
CAST(SUM(s.quantity) AS DECIMAL(10,0)) as sinServir,
|
||||||
|
@ -10,14 +12,15 @@ SELECT s.itemFk,
|
||||||
FROM vn.sale s
|
FROM vn.sale s
|
||||||
LEFT JOIN vn.itemShelvingSale iss ON iss.saleFk = s.id
|
LEFT JOIN vn.itemShelvingSale iss ON iss.saleFk = s.id
|
||||||
JOIN vn.ticket t ON t.id = s.ticketFk
|
JOIN vn.ticket t ON t.id = s.ticketFk
|
||||||
LEFT JOIN vn.itemShelvingStock ist ON ist.itemFk = s.itemFk AND ist.warehouseFk = vWarehouseFk
|
LEFT JOIN vn.itemShelvingStock ist ON ist.itemFk = s.itemFk
|
||||||
JOIN vn.itemShelving ish ON ish.itemFk = s.itemFk AND ish.shelvingFk = vShelvingFk COLLATE utf8_general_ci
|
AND ist.warehouseFk = vWarehouseFk
|
||||||
|
JOIN vn.itemShelving ish ON ish.itemFk = s.itemFk
|
||||||
|
JOIN shelving sh ON sh.id = ish.shelvingFk
|
||||||
|
AND sh.code = vShelvingCode COLLATE utf8_general_ci
|
||||||
WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(TIMESTAMPADD(DAY, GREATEST(0,vDayRange), util.VN_CURDATE()))
|
WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(TIMESTAMPADD(DAY, GREATEST(0,vDayRange), util.VN_CURDATE()))
|
||||||
AND iss.saleFk IS NULL
|
AND iss.saleFk IS NULL
|
||||||
AND t.warehouseFk = vWarehouseFk
|
AND t.warehouseFk = vWarehouseFk
|
||||||
GROUP BY s.itemFk
|
GROUP BY s.itemFk
|
||||||
HAVING sinServir > aparcado;
|
HAVING sinServir > aparcado;
|
||||||
|
|
||||||
|
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -25,7 +25,7 @@ BEGIN
|
||||||
LEFT JOIN (
|
LEFT JOIN (
|
||||||
SELECT ish.itemFk, CAST(SUM(ish.visible) AS DECIMAL(10,0)) AS reserva
|
SELECT ish.itemFk, CAST(SUM(ish.visible) AS DECIMAL(10,0)) AS reserva
|
||||||
FROM vn.itemShelving ish
|
FROM vn.itemShelving ish
|
||||||
JOIN vn.shelving sh ON sh.code = ish.shelvingFk
|
JOIN vn.shelving sh ON sh.id = ish.shelvingFk
|
||||||
JOIN vn.parking p ON p.id = sh.parkingFk
|
JOIN vn.parking p ON p.id = sh.parkingFk
|
||||||
JOIN vn.sector s ON s.id = p.sectorFk
|
JOIN vn.sector s ON s.id = p.sectorFk
|
||||||
WHERE s.code = 'FUENTES_PICASSE'
|
WHERE s.code = 'FUENTES_PICASSE'
|
||||||
|
@ -68,7 +68,7 @@ BEGIN
|
||||||
sh.isSpam
|
sh.isSpam
|
||||||
FROM vn.itemShelving ish
|
FROM vn.itemShelving ish
|
||||||
JOIN vn.item i ON i.id = ish.itemFk
|
JOIN vn.item i ON i.id = ish.itemFk
|
||||||
JOIN vn.shelving sh ON sh.code = ish.shelvingFk
|
JOIN vn.shelving sh ON sh.id = ish.shelvingFk
|
||||||
JOIN vn.parking p ON p.id = sh.parkingFk
|
JOIN vn.parking p ON p.id = sh.parkingFk
|
||||||
JOIN vn.sector s ON s.id = p.sectorFk
|
JOIN vn.sector s ON s.id = p.sectorFk
|
||||||
JOIN vn.warehouse w ON w.id = s.warehouseFk
|
JOIN vn.warehouse w ON w.id = s.warehouseFk
|
||||||
|
|
|
@ -9,7 +9,7 @@ BEGIN
|
||||||
JOIN vn.sale s ON s.ticketFk = t.id
|
JOIN vn.sale s ON s.ticketFk = t.id
|
||||||
JOIN vn.itemShelvingSale iss ON iss.saleFk = s.id
|
JOIN vn.itemShelvingSale iss ON iss.saleFk = s.id
|
||||||
JOIN vn.itemShelving ish ON ish.id = iss.itemShelvingFk
|
JOIN vn.itemShelving ish ON ish.id = iss.itemShelvingFk
|
||||||
JOIN vn.shelving sh ON sh.code = ish.shelvingFk
|
JOIN vn.shelving sh ON sh.id = ish.shelvingFk
|
||||||
JOIN vn.parking p ON p.id = sh.parkingFk
|
JOIN vn.parking p ON p.id = sh.parkingFk
|
||||||
WHERE p.sectorFk = vSectorFk
|
WHERE p.sectorFk = vSectorFk
|
||||||
) sub ON sub.id = td.ticketFk
|
) sub ON sub.id = td.ticketFk
|
||||||
|
|
|
@ -27,7 +27,7 @@ BEGIN
|
||||||
SUM(ish.visible) visible,
|
SUM(ish.visible) visible,
|
||||||
s.warehouseFk warehouseFk
|
s.warehouseFk warehouseFk
|
||||||
FROM itemShelving ish
|
FROM itemShelving ish
|
||||||
JOIN shelving sh ON sh.code = ish.shelvingFk
|
JOIN shelving sh ON sh.id = ish.shelvingFk
|
||||||
JOIN parking p ON p.id = sh.parkingFk
|
JOIN parking p ON p.id = sh.parkingFk
|
||||||
JOIN sector s ON s.id = p.sectorFk
|
JOIN sector s ON s.id = p.sectorFk
|
||||||
GROUP BY ish.itemFk,
|
GROUP BY ish.itemFk,
|
||||||
|
|
|
@ -28,7 +28,7 @@ BEGIN
|
||||||
SUM(ish.visible) visible,
|
SUM(ish.visible) visible,
|
||||||
s.warehouseFk warehouseFk
|
s.warehouseFk warehouseFk
|
||||||
FROM itemShelving ish
|
FROM itemShelving ish
|
||||||
JOIN shelving sh ON sh.code = ish.shelvingFk
|
JOIN shelving sh ON sh.id = ish.shelvingFk
|
||||||
JOIN parking p ON p.id = sh.parkingFk
|
JOIN parking p ON p.id = sh.parkingFk
|
||||||
JOIN sector s ON s.id = p.sectorFk
|
JOIN sector s ON s.id = p.sectorFk
|
||||||
GROUP BY ish.itemFk,
|
GROUP BY ish.itemFk,
|
||||||
|
|
|
@ -15,7 +15,7 @@ FROM (
|
||||||
(
|
(
|
||||||
(
|
(
|
||||||
`vn`.`itemShelving` `ish`
|
`vn`.`itemShelving` `ish`
|
||||||
JOIN `vn`.`shelving` `sh` ON(`sh`.`code` = `ish`.`shelvingFk`)
|
JOIN `vn`.`shelving` `sh` ON(`sh`.`id` = `ish`.`shelvingFk`)
|
||||||
)
|
)
|
||||||
JOIN `vn`.`item` `i` ON(`i`.`id` = `ish`.`itemFk`)
|
JOIN `vn`.`item` `i` ON(`i`.`id` = `ish`.`itemFk`)
|
||||||
)
|
)
|
||||||
|
|
|
@ -18,7 +18,7 @@ FROM (
|
||||||
(
|
(
|
||||||
(
|
(
|
||||||
`vn`.`itemShelving` `ish`
|
`vn`.`itemShelving` `ish`
|
||||||
JOIN `vn`.`shelving` `sh` ON(`sh`.`code` = `ish`.`shelvingFk`)
|
JOIN `vn`.`shelving` `sh` ON(`sh`.`id` = `ish`.`shelvingFk`)
|
||||||
)
|
)
|
||||||
LEFT JOIN `vn`.`parking` `p` ON(`p`.`id` = `sh`.`parkingFk`)
|
LEFT JOIN `vn`.`parking` `p` ON(`p`.`id` = `sh`.`parkingFk`)
|
||||||
)
|
)
|
||||||
|
|
|
@ -13,7 +13,7 @@ FROM (
|
||||||
`vn`.`itemShelvingSale` `iss`
|
`vn`.`itemShelvingSale` `iss`
|
||||||
JOIN `vn`.`itemShelving` `ish` ON(`ish`.`id` = `iss`.`itemShelvingFk`)
|
JOIN `vn`.`itemShelving` `ish` ON(`ish`.`id` = `iss`.`itemShelvingFk`)
|
||||||
)
|
)
|
||||||
JOIN `vn`.`shelving` `sh` ON(`sh`.`code` = `ish`.`shelvingFk`)
|
JOIN `vn`.`shelving` `sh` ON(`sh`.`id` = `ish`.`shelvingFk`)
|
||||||
)
|
)
|
||||||
JOIN `vn`.`parking` `p` ON(`p`.`id` = `sh`.`parkingFk`)
|
JOIN `vn`.`parking` `p` ON(`p`.`id` = `sh`.`parkingFk`)
|
||||||
)
|
)
|
||||||
|
|
|
@ -21,7 +21,7 @@ FROM (
|
||||||
(
|
(
|
||||||
(
|
(
|
||||||
`vn`.`itemShelving` `ish`
|
`vn`.`itemShelving` `ish`
|
||||||
LEFT JOIN `vn`.`shelving` `sh` ON(`sh`.`code` = `ish`.`shelvingFk`)
|
LEFT JOIN `vn`.`shelving` `sh` ON(`sh`.`id` = `ish`.`shelvingFk`)
|
||||||
)
|
)
|
||||||
LEFT JOIN `vn`.`parking` `p` ON(`p`.`id` = `sh`.`parkingFk`)
|
LEFT JOIN `vn`.`parking` `p` ON(`p`.`id` = `sh`.`parkingFk`)
|
||||||
)
|
)
|
||||||
|
|
|
@ -19,7 +19,7 @@ FROM (
|
||||||
(
|
(
|
||||||
(
|
(
|
||||||
`vn`.`itemShelving` `ish`
|
`vn`.`itemShelving` `ish`
|
||||||
JOIN `vn`.`shelving` `sh` ON(`sh`.`code` = `ish`.`shelvingFk`)
|
JOIN `vn`.`shelving` `sh` ON(`sh`.`id` = `ish`.`shelvingFk`)
|
||||||
)
|
)
|
||||||
JOIN `vn`.`parking` `p` ON(`p`.`id` = `sh`.`parkingFk`)
|
JOIN `vn`.`parking` `p` ON(`p`.`id` = `sh`.`parkingFk`)
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue