refs #6915 test_master24_8 #2067
|
@ -13,7 +13,7 @@ RUN apt-get update \
|
||||||
graphicsmagick \
|
graphicsmagick \
|
||||||
&& curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
|
&& curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
|
||||||
&& apt-get install -y --no-install-recommends nodejs \
|
&& apt-get install -y --no-install-recommends nodejs \
|
||||||
&& curl -fsSL https://get.pnpm.io/install.sh | env PNPM_VERSION=8.15.1 sh -
|
&& corepack enable pnpm
|
||||||
|
|
||||||
# Puppeteer
|
# Puppeteer
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,8 @@ proc: BEGIN
|
||||||
DECLARE vReserveDate DATETIME;
|
DECLARE vReserveDate DATETIME;
|
||||||
DECLARE vParams CHAR(100);
|
DECLARE vParams CHAR(100);
|
||||||
DECLARE vInventoryDate DATE;
|
DECLARE vInventoryDate DATE;
|
||||||
DECLARE vIsLogifloraDay BOOLEAN;
|
DECLARE vLifeScope DATE;
|
||||||
|
DECLARE vWarehouseFkInventory INT;
|
||||||
|
|
||||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||||
BEGIN
|
BEGIN
|
||||||
|
@ -26,43 +27,42 @@ proc: BEGIN
|
||||||
LEAVE proc;
|
LEAVE proc;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
-- Invoca al procedimiento que genera el stock virtual de Logiflora, si coincide con la peticion de refresco del disponible
|
|
||||||
IF vn.isLogifloraDay(vDated, vWarehouse) THEN
|
|
||||||
-- CALL edi.floramondo_offerRefresh;
|
|
||||||
SET vIsLogifloraDay = TRUE;
|
|
||||||
ELSE
|
|
||||||
SET vIsLogifloraDay = FALSE;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
-- Calcula algunos parámetros necesarios
|
-- Calcula algunos parámetros necesarios
|
||||||
SET vStartDate = TIMESTAMP(vDated, '00:00:00');
|
SET vStartDate = TIMESTAMP(vDated, '00:00:00');
|
||||||
SELECT inventoried INTO vInventoryDate FROM vn.config;
|
SELECT inventoried INTO vInventoryDate FROM vn.config;
|
||||||
|
SELECT DATE_SUB(vStartDate, INTERVAL MAX(life) DAY) INTO vLifeScope FROM vn.itemType;
|
||||||
SELECT SUBTIME(util.VN_NOW(), reserveTime) INTO vReserveDate
|
SELECT SUBTIME(util.VN_NOW(), reserveTime) INTO vReserveDate
|
||||||
FROM hedera.orderConfig;
|
FROM hedera.orderConfig;
|
||||||
|
|
||||||
|
SELECT w.id INTO vWarehouseFkInventory
|
||||||
|
FROM vn.warehouse w
|
||||||
|
WHERE w.code = 'inv';
|
||||||
|
|
||||||
-- Calcula el ultimo dia de vida para cada producto
|
-- Calcula el ultimo dia de vida para cada producto
|
||||||
DROP TEMPORARY TABLE IF EXISTS itemRange;
|
DROP TEMPORARY TABLE IF EXISTS itemRange;
|
||||||
CREATE TEMPORARY TABLE itemRange
|
CREATE TEMPORARY TABLE itemRange
|
||||||
(PRIMARY KEY (itemFk))
|
(PRIMARY KEY (itemFk))
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
SELECT c.itemFk,
|
SELECT i.id itemFk,
|
||||||
IF(it.life IS NULL,
|
util.dayEnd(DATE_ADD(c.maxLanded, INTERVAL it.life DAY)) ended, it.life
|
||||||
NULL,
|
FROM vn.item i
|
||||||
TIMESTAMP(TIMESTAMPADD(DAY, it.life, c.landing), '23:59:59')) ended
|
LEFT JOIN (
|
||||||
FROM (
|
SELECT b.itemFk, MAX(t.landed) maxLanded
|
||||||
SELECT b.itemFk, MAX(t.landed) landing
|
FROM vn.buy b
|
||||||
FROM vn.buy b
|
JOIN vn.entry e ON b.entryFk = e.id
|
||||||
JOIN vn.entry e ON b.entryFk = e.id
|
JOIN vn.travel t ON t.id = e.travelFk
|
||||||
JOIN vn.travel t ON t.id = e.travelFk
|
JOIN vn.warehouse w ON w.id = t.warehouseInFk
|
||||||
JOIN vn.warehouse w ON w.id = t.warehouseInFk
|
JOIN vn.item i ON i.id = b.itemFk
|
||||||
WHERE t.landed BETWEEN vInventoryDate AND vStartDate
|
JOIN vn.itemType it ON it.id = i.typeFk
|
||||||
AND t.warehouseInFk = vWarehouse
|
WHERE t.landed BETWEEN vLifeScope AND vStartDate
|
||||||
AND NOT e.isExcludedFromAvailable
|
AND t.warehouseInFk = vWarehouse
|
||||||
GROUP BY b.itemFk
|
AND t.warehouseOutFk <> vWarehouseFkInventory
|
||||||
) c
|
AND it.life
|
||||||
JOIN vn.item i ON i.id = c.itemFk
|
AND NOT e.isExcludedFromAvailable
|
||||||
|
GROUP BY b.itemFk
|
||||||
|
) c ON i.id = c.itemFk
|
||||||
JOIN vn.itemType it ON it.id = i.typeFk
|
JOIN vn.itemType it ON it.id = i.typeFk
|
||||||
HAVING ended >= vStartDate OR ended IS NULL;
|
HAVING ended >= vStartDate OR life IS NULL;
|
||||||
|
|
||||||
-- Calcula el ATP
|
-- Calcula el ATP
|
||||||
DELETE FROM available WHERE calc_id = vCalc;
|
DELETE FROM available WHERE calc_id = vCalc;
|
||||||
|
@ -86,7 +86,7 @@ proc: BEGIN
|
||||||
WHERE i.landed >= vStartDate
|
WHERE i.landed >= vStartDate
|
||||||
AND (ir.ended IS NULL OR i.landed <= ir.ended)
|
AND (ir.ended IS NULL OR i.landed <= ir.ended)
|
||||||
AND i.warehouseInFk = vWarehouse
|
AND i.warehouseInFk = vWarehouse
|
||||||
AND (ISNULL(wf.entryFk) OR vIsLogifloraDay)
|
AND ISNULL(wf.entryFk)
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT i.itemFk, i.shipped, i.quantity
|
SELECT i.itemFk, i.shipped, i.quantity
|
||||||
FROM vn.itemEntryOut i
|
FROM vn.itemEntryOut i
|
||||||
|
|
|
@ -15,7 +15,7 @@ SELECT pack.packages,
|
||||||
LEFT JOIN vn.province p ON p.id = c.provinceFk
|
LEFT JOIN vn.province p ON p.id = c.provinceFk
|
||||||
JOIN vn.ticket t ON t.refFk = io.ref
|
JOIN vn.ticket t ON t.refFk = io.ref
|
||||||
JOIN vn.address a ON a.id = t.addressFk
|
JOIN vn.address a ON a.id = t.addressFk
|
||||||
LEFT JOIN vn.incoterms ic ON ic.code = a.incotermsFk
|
JOIN vn.incoterms ic ON ic.code = a.incotermsFk
|
||||||
LEFT JOIN vn.customsAgent ca ON ca.id = a.customsAgentFk
|
LEFT JOIN vn.customsAgent ca ON ca.id = a.customsAgentFk
|
||||||
JOIN vn.sale s ON s.ticketFk = t.id
|
JOIN vn.sale s ON s.ticketFk = t.id
|
||||||
JOIN (
|
JOIN (
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
SELECT IF(incotermsFk IS NULL, FALSE, TRUE) AS hasIncoterms
|
SELECT COUNT(*) AS hasIncoterms
|
||||||
FROM ticket t
|
FROM invoiceOut io
|
||||||
JOIN invoiceOut io ON io.ref = t.refFk
|
JOIN vn.invoiceOutSerial ios ON ios.code = io.serial
|
||||||
JOIN client c ON c.id = t.clientFk
|
AND ios.taxAreaFk = 'WORLD'
|
||||||
JOIN address a ON a.id = t.addressFk
|
WHERE io.ref = ?
|
||||||
WHERE t.refFk = ?
|
|
||||||
AND IF(c.hasToinvoiceByAddress = FALSE, c.defaultAddressFk, TRUE)
|
|
||||||
LIMIT 1
|
|
||||||
|
|
Loading…
Reference in New Issue