Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 7292-createAddresUEEMember
gitea/salix/pipeline/pr-dev There was a failure building this commit
Details
gitea/salix/pipeline/pr-dev There was a failure building this commit
Details
This commit is contained in:
commit
f45f909995
|
@ -23,7 +23,6 @@ proc: BEGIN
|
||||||
* @param tmp.comparativeFilterType(filterFk INT ,itemTypeFk INT)
|
* @param tmp.comparativeFilterType(filterFk INT ,itemTypeFk INT)
|
||||||
* @return tmp.comparative
|
* @return tmp.comparative
|
||||||
*/
|
*/
|
||||||
|
|
||||||
DECLARE vDayRangeStart DATE;
|
DECLARE vDayRangeStart DATE;
|
||||||
DECLARE vDayRangeEnd DATE;
|
DECLARE vDayRangeEnd DATE;
|
||||||
DECLARE w1, w2, w3, w4, w5, w6, w7 INT;
|
DECLARE w1, w2, w3, w4, w5, w6, w7 INT;
|
||||||
|
@ -59,14 +58,14 @@ proc: BEGIN
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
SELECT MIN(dated) INTO vDayRangeStart
|
SELECT MIN(dated) INTO vDayRangeStart
|
||||||
FROM vn.time
|
FROM `time`
|
||||||
WHERE dated <= vDate
|
WHERE dated <= vDate
|
||||||
GROUP BY period
|
GROUP BY period
|
||||||
ORDER BY dated desc
|
ORDER BY dated desc
|
||||||
LIMIT 1 OFFSET vWeekRange;
|
LIMIT 1 OFFSET vWeekRange;
|
||||||
|
|
||||||
SELECT MAX(dated) INTO vDayRangeEnd
|
SELECT MAX(dated) INTO vDayRangeEnd
|
||||||
FROM vn.time
|
FROM `time`
|
||||||
WHERE dated >= vDate
|
WHERE dated >= vDate
|
||||||
GROUP BY period
|
GROUP BY period
|
||||||
ORDER BY dated ASC
|
ORDER BY dated ASC
|
||||||
|
@ -83,12 +82,11 @@ proc: BEGIN
|
||||||
JOIN itemType t ON t.id = i.typeFk
|
JOIN itemType t ON t.id = i.typeFk
|
||||||
JOIN itemCategory c ON c.id = t.categoryFk
|
JOIN itemCategory c ON c.id = t.categoryFk
|
||||||
LEFT JOIN worker w ON w.id = t.workerFk
|
LEFT JOIN worker w ON w.id = t.workerFk
|
||||||
WHERE (NOT vHasTypeFilter
|
WHERE (NOT vHasTypeFilter OR t.id IN (
|
||||||
OR t.id IN (SELECT itemTypeFk FROM tmp.comparativeFilterType))
|
SELECT itemTypeFk FROM tmp.comparativeFilterType
|
||||||
AND (vBuyerFk IS NULL
|
))
|
||||||
OR t.workerFk = vBuyerFk)
|
AND (vBuyerFk IS NULL OR t.workerFk = vBuyerFk)
|
||||||
AND (vIsFloramondo IS NULL
|
AND (vIsFloramondo IS NULL OR i.isFloramondo = vIsFloramondo);
|
||||||
OR i.isFloramondo = vIsFloramondo);
|
|
||||||
|
|
||||||
IF vDate < util.VN_CURDATE() THEN
|
IF vDate < util.VN_CURDATE() THEN
|
||||||
ALTER TABLE tmp.itemInventory
|
ALTER TABLE tmp.itemInventory
|
||||||
|
@ -115,10 +113,11 @@ proc: BEGIN
|
||||||
SET i = i + 1;
|
SET i = i + 1;
|
||||||
|
|
||||||
SELECT t.period INTO vPeriod
|
SELECT t.period INTO vPeriod
|
||||||
FROM vn.`time` t
|
FROM `time` t
|
||||||
WHERE t.dated = vDayRangeStart + INTERVAL (vWeekCount * (i - 1)) DAY;
|
WHERE t.dated = vDayRangeStart + INTERVAL (vWeekCount * (i - 1)) DAY;
|
||||||
|
|
||||||
INSERT IGNORE INTO tTable(cy, ly, zy) VALUES(vPeriod, vPeriod - 100, vPeriod - 200);
|
INSERT IGNORE INTO tTable(cy, ly, zy)
|
||||||
|
VALUES(vPeriod, vPeriod - 100, vPeriod - 200);
|
||||||
UNTIL i = vWeekCount END REPEAT;
|
UNTIL i = vWeekCount END REPEAT;
|
||||||
|
|
||||||
SELECT cy, ly, zy INTO w1, y1, z1 FROM tTable LIMIT 1;
|
SELECT cy, ly, zy INTO w1, y1, z1 FROM tTable LIMIT 1;
|
||||||
|
@ -130,7 +129,6 @@ proc: BEGIN
|
||||||
SELECT cy, ly, zy INTO w7, y7, z7 FROM tTable WHERE cy > w6 LIMIT 1;
|
SELECT cy, ly, zy INTO w7, y7, z7 FROM tTable WHERE cy > w6 LIMIT 1;
|
||||||
|
|
||||||
-- Genera una tabla con los datos del año pasado.
|
-- Genera una tabla con los datos del año pasado.
|
||||||
|
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tLastYear
|
CREATE OR REPLACE TEMPORARY TABLE tLastYear
|
||||||
(KEY (lItemFk))
|
(KEY (lItemFk))
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
|
@ -151,15 +149,14 @@ proc: BEGIN
|
||||||
SUM(IF(c.timePeriod = y7, c.price, 0)) lprice7
|
SUM(IF(c.timePeriod = y7, c.price, 0)) lprice7
|
||||||
FROM tmp.itemInventory ai
|
FROM tmp.itemInventory ai
|
||||||
JOIN comparative c ON c.itemFk = ai.id
|
JOIN comparative c ON c.itemFk = ai.id
|
||||||
JOIN warehouse w on w.id = c.warehouseFk
|
JOIN warehouse w ON w.id = c.warehouseFk
|
||||||
JOIN tTable wt ON c.timePeriod = wt.ly
|
JOIN tTable wt ON c.timePeriod = wt.ly
|
||||||
WHERE IFNULL(vWarehouseFk, c.warehouseFk) = c.warehouseFk
|
WHERE (vWarehouseFk IS NULL OR vWarehouseFk = c.warehouseFk)
|
||||||
AND w.isComparative
|
AND w.isComparative
|
||||||
AND (vCountryFk IS NULL OR c.countryFk = vCountryFk)
|
AND (vCountryFk IS NULL OR c.countryFk = vCountryFk)
|
||||||
GROUP BY ai.id;
|
GROUP BY ai.id;
|
||||||
|
|
||||||
-- Genera una tabla con los datos de hace DOS años.
|
-- Genera una tabla con los datos de hace 2 años
|
||||||
|
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tTwoYearsAgo
|
CREATE OR REPLACE TEMPORARY TABLE tTwoYearsAgo
|
||||||
(KEY (tItemFk))
|
(KEY (tItemFk))
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
|
@ -180,59 +177,58 @@ proc: BEGIN
|
||||||
SUM(IF(c.timePeriod = z7, c.price, 0)) vlprice7
|
SUM(IF(c.timePeriod = z7, c.price, 0)) vlprice7
|
||||||
FROM tmp.itemInventory ai
|
FROM tmp.itemInventory ai
|
||||||
JOIN comparative c ON c.itemFk = ai.id
|
JOIN comparative c ON c.itemFk = ai.id
|
||||||
JOIN warehouse w on w.id = c.warehouseFk
|
JOIN warehouse w ON w.id = c.warehouseFk
|
||||||
JOIN tTable wt ON c.timePeriod = wt.zy
|
JOIN tTable wt ON c.timePeriod = wt.zy
|
||||||
WHERE IFNULL(vWarehouseFk, c.warehouseFk) = c.warehouseFk
|
WHERE (vWarehouseFk IS NULL OR vWarehouseFk = c.warehouseFk)
|
||||||
AND w.isComparative
|
AND w.isComparative
|
||||||
AND (vCountryFk IS NULL OR c.countryFk = vCountryFk)
|
AND (vCountryFk IS NULL OR c.countryFk = vCountryFk)
|
||||||
GROUP BY ai.id;
|
GROUP BY ai.id;
|
||||||
|
|
||||||
-- Genera una tabla con los datos de este año.ss
|
-- Genera una tabla con los datos de este año
|
||||||
|
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tCurrentYear
|
CREATE OR REPLACE TEMPORARY TABLE tCurrentYear
|
||||||
(KEY (cItemFk))
|
(KEY (cItemFk))
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
SELECT t.itemFk cItemFk,
|
SELECT t.itemFk cItemFk,
|
||||||
SUM(IF(week = w1, total, 0)) cweek1,
|
SUM(IF(`week` = w1, total, 0)) cweek1,
|
||||||
SUM(IF(week = w2, total, 0)) cweek2,
|
SUM(IF(`week` = w2, total, 0)) cweek2,
|
||||||
SUM(IF(week = w3, total, 0)) cweek3,
|
SUM(IF(`week` = w3, total, 0)) cweek3,
|
||||||
SUM(IF(week = w4, total, 0)) cweek4,
|
SUM(IF(`week` = w4, total, 0)) cweek4,
|
||||||
SUM(IF(week = w5, total, 0)) cweek5,
|
SUM(IF(`week` = w5, total, 0)) cweek5,
|
||||||
SUM(IF(week = w6, total, 0)) cweek6,
|
SUM(IF(`week` = w6, total, 0)) cweek6,
|
||||||
SUM(IF(week = w7, total, 0)) cweek7,
|
SUM(IF(`week` = w7, total, 0)) cweek7,
|
||||||
SUM(IF(week = w1, price, 0)) cprice1,
|
SUM(IF(`week` = w1, price, 0)) cprice1,
|
||||||
SUM(IF(week = w2, price, 0)) cprice2,
|
SUM(IF(`week` = w2, price, 0)) cprice2,
|
||||||
SUM(IF(week = w3, price, 0)) cprice3,
|
SUM(IF(`week` = w3, price, 0)) cprice3,
|
||||||
SUM(IF(week = w4, price, 0)) cprice4,
|
SUM(IF(`week` = w4, price, 0)) cprice4,
|
||||||
SUM(IF(week = w5, price, 0)) cprice5,
|
SUM(IF(`week` = w5, price, 0)) cprice5,
|
||||||
SUM(IF(week = w6, price, 0)) cprice6,
|
SUM(IF(`week` = w6, price, 0)) cprice6,
|
||||||
SUM(IF(week = w7, price, 0)) cprice7
|
SUM(IF(`week` = w7, price, 0)) cprice7
|
||||||
FROM (
|
FROM (
|
||||||
SELECT s.itemFk,
|
SELECT s.itemFk,
|
||||||
ti.period `week`,
|
ti.period `week`,
|
||||||
SUM(s.quantity) total,
|
SUM(s.quantity) total,
|
||||||
TRUNCATE(SUM(s.quantity * s.priceFixed), 0) price
|
TRUNCATE(SUM(s.quantity * s.priceFixed), 0) price
|
||||||
FROM ticket t
|
FROM ticket t FORCE INDEX (Fecha)
|
||||||
JOIN sale s ON t.id = s.ticketFk
|
JOIN sale s ON t.id = s.ticketFk
|
||||||
JOIN tmp.itemInventory it ON it.id = s.itemFk
|
JOIN tmp.itemInventory it ON it.id = s.itemFk
|
||||||
JOIN time ti ON ti.dated = DATE(t.shipped)
|
JOIN `time` ti ON ti.dated = DATE(t.shipped)
|
||||||
JOIN item i ON i.id = s.itemFk
|
JOIN item i ON i.id = s.itemFk
|
||||||
JOIN itemType tp ON tp.id = i.typeFk
|
JOIN itemType tp ON tp.id = i.typeFk
|
||||||
JOIN itemCategory ic ON ic.id = tp.categoryFk
|
JOIN itemCategory ic ON ic.id = tp.categoryFk
|
||||||
JOIN warehouse w ON w.id = t.warehouseFk
|
JOIN warehouse w ON w.id = t.warehouseFk
|
||||||
STRAIGHT_JOIN address ad ON ad.id = t.addressFk
|
JOIN `address` ad ON ad.id = t.addressFk
|
||||||
JOIN province p ON p.id = ad.provinceFk
|
JOIN province p ON p.id = ad.provinceFk
|
||||||
JOIN `client` c ON c.id = ad.clientFk
|
JOIN `client` c ON c.id = ad.clientFk
|
||||||
WHERE t.shipped BETWEEN vDayRangeStart AND util.dayEnd(vDayRangeEnd)
|
WHERE t.shipped BETWEEN vDayRangeStart AND util.dayEnd(vDayRangeEnd)
|
||||||
AND c.typeFk IN ('Normal','handMaking')
|
AND c.typeFk IN ('normal', 'handMaking')
|
||||||
AND w.id = COALESCE(vWarehouseFk, w.id)
|
AND (vWarehouseFk IS NULL OR vWarehouseFk = w.id)
|
||||||
AND w.isComparative
|
|
||||||
AND (vCountryFk IS NULL OR p.countryFk = vCountryFk)
|
AND (vCountryFk IS NULL OR p.countryFk = vCountryFk)
|
||||||
GROUP BY i.id, week
|
AND w.isComparative
|
||||||
|
GROUP BY i.id, `week`
|
||||||
) t
|
) t
|
||||||
GROUP BY t.itemFk;
|
GROUP BY t.itemFk;
|
||||||
|
|
||||||
-- Genera la tabla con la comparativa.
|
-- Genera la tabla con la comparativa
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tmp.comparative
|
CREATE OR REPLACE TEMPORARY TABLE tmp.comparative
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
SELECT it.subName productor,
|
SELECT it.subName productor,
|
||||||
|
@ -240,13 +236,13 @@ proc: BEGIN
|
||||||
b.buyingValue costefijo,
|
b.buyingValue costefijo,
|
||||||
b.groupingMode caja,
|
b.groupingMode caja,
|
||||||
it.image ArticleImage,
|
it.image ArticleImage,
|
||||||
IFNULL(it.inkFk,"?") color,
|
IFNULL(it.inkFk, '?') color,
|
||||||
tp.code tipo,
|
tp.code tipo,
|
||||||
it.typeFk tipo_id,
|
it.typeFk tipo_id,
|
||||||
o.code origen,
|
o.code origen,
|
||||||
it.category categoria,
|
it.category categoria,
|
||||||
it.stems tallos,
|
it.stems tallos,
|
||||||
it.size medida,
|
it.`size` medida,
|
||||||
it.name article,
|
it.name article,
|
||||||
w.code codigoTrabajador,
|
w.code codigoTrabajador,
|
||||||
tp.categoryFk reino_id,
|
tp.categoryFk reino_id,
|
||||||
|
@ -264,17 +260,20 @@ proc: BEGIN
|
||||||
e.id provider_id,
|
e.id provider_id,
|
||||||
it.comment comments,
|
it.comment comments,
|
||||||
it.description itemDescription,
|
it.description itemDescription,
|
||||||
IF(cy.cItemFk IS NULL AND i.visible = 0 AND i.avalaible = 0
|
IF(cy.cItemFk IS NULL AND i.visible = 0
|
||||||
AND IFNULL(i.sd, 0) = 0, FALSE, TRUE) filtret,
|
AND i.avalaible = 0 AND (i.sd IS NULL OR i.sd = 0),
|
||||||
|
FALSE,
|
||||||
|
TRUE
|
||||||
|
) filtret,
|
||||||
IF(it.hasMinPrice, FORMAT(it.minPrice, 2), "") pvp,
|
IF(it.hasMinPrice, FORMAT(it.minPrice, 2), "") pvp,
|
||||||
s.company_name
|
s.company_name
|
||||||
FROM tmp.itemInventory i
|
FROM tmp.itemInventory i
|
||||||
JOIN item it ON it.id = i.id
|
JOIN item it ON it.id = i.id
|
||||||
LEFT JOIN itemType tp ON tp.id = it.typeFk
|
JOIN itemType tp ON tp.id = it.typeFk
|
||||||
LEFT JOIN worker w ON w.id = tp.workerFk
|
JOIN worker w ON w.id = tp.workerFk
|
||||||
LEFT JOIN buy b ON b.id = i.buy_id
|
LEFT JOIN buy b ON b.id = i.buy_id
|
||||||
LEFT JOIN entry e ON e.id = b.entryFk
|
LEFT JOIN `entry` e ON e.id = b.entryFk
|
||||||
LEFT JOIN origin o ON o.id = it.originFk
|
JOIN origin o ON o.id = it.originFk
|
||||||
LEFT JOIN tLastYear ly ON ly.lItemFk = it.id
|
LEFT JOIN tLastYear ly ON ly.lItemFk = it.id
|
||||||
LEFT JOIN tCurrentYear cy ON cy.cItemFk = it.id
|
LEFT JOIN tCurrentYear cy ON cy.cItemFk = it.id
|
||||||
LEFT JOIN tTwoYearsAgo zy ON zy.tItemFk = it.id
|
LEFT JOIN tTwoYearsAgo zy ON zy.tItemFk = it.id
|
||||||
|
@ -287,8 +286,8 @@ proc: BEGIN
|
||||||
OR ly.lweek1 OR ly.lweek2 OR ly.lweek3 OR ly.lweek4 OR ly.lweek5 OR ly.lweek6 OR ly.lweek7
|
OR ly.lweek1 OR ly.lweek2 OR ly.lweek3 OR ly.lweek4 OR ly.lweek5 OR ly.lweek6 OR ly.lweek7
|
||||||
OR zy.vlweek1 OR zy.vlweek2 OR zy.vlweek3 OR zy.vlweek4 OR zy.vlweek5 OR zy.vlweek6 OR zy.vlweek7;
|
OR zy.vlweek1 OR zy.vlweek2 OR zy.vlweek3 OR zy.vlweek4 OR zy.vlweek5 OR zy.vlweek6 OR zy.vlweek7;
|
||||||
|
|
||||||
-- Elimina las tablas temporales creadas...
|
DROP TEMPORARY TABLE IF EXISTS
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.itemInventory,
|
tmp.itemInventory,
|
||||||
tTwoYearsAgo,
|
tTwoYearsAgo,
|
||||||
tLastYear,
|
tLastYear,
|
||||||
tCurrentYear,
|
tCurrentYear,
|
||||||
|
|
|
@ -12,12 +12,15 @@ BEGIN
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tmp.sale
|
CREATE OR REPLACE TEMPORARY TABLE tmp.sale
|
||||||
(INDEX(saleFk))
|
(INDEX(saleFk))
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
SELECT s.id saleFk, sale_hasComponentLack(s.id) hasProblem
|
SELECT saleFk, sale_hasComponentLack(saleFk)hasProblem
|
||||||
|
FROM (
|
||||||
|
SELECT s.id saleFk
|
||||||
FROM ticket t
|
FROM ticket t
|
||||||
JOIN sale s ON s.ticketFk = t.id
|
JOIN sale s ON s.ticketFk = t.id
|
||||||
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
|
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
|
||||||
WHERE t.shipped >= util.midnight()
|
WHERE t.shipped >= util.midnight()
|
||||||
AND (vComponentFk IS NULL OR sc.componentFk = vComponentFk);
|
AND (vComponentFk IS NULL OR sc.componentFk = vComponentFk)
|
||||||
|
GROUP BY s.id) sub;
|
||||||
|
|
||||||
CALL sale_setProblem('hasComponentLack');
|
CALL sale_setProblem('hasComponentLack');
|
||||||
|
|
||||||
|
|
|
@ -20,15 +20,15 @@ BEGIN
|
||||||
|
|
||||||
CALL buyUltimate(vWarehouseFk, vShipped);
|
CALL buyUltimate(vWarehouseFk, vShipped);
|
||||||
|
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
|
CREATE OR REPLACE TEMPORARY TABLE tmp.sale
|
||||||
SELECT vSelf saleFk, MOD(vQuantity, bu.`grouping`) hasProblem
|
SELECT vSelf saleFk, MOD(vQuantity, b.`grouping`) hasProblem
|
||||||
FROM tmp.buyUltimate bu
|
FROM tmp.buyUltimate bu
|
||||||
JOIN buy b ON b.id = bu.buyFk
|
JOIN buy b ON b.id = bu.buyFk
|
||||||
WHERE bu.itemFk = vItemFk;
|
WHERE bu.itemFk = vItemFk;
|
||||||
|
|
||||||
CALL sale_setProblem('hasRounding');
|
CALL sale_setProblem('hasRounding');
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tmp.ticket;
|
DROP TEMPORARY TABLE tmp.sale;
|
||||||
DROP TEMPORARY TABLE tmp.buyUltimate;
|
DROP TEMPORARY TABLE tmp.buyUltimate;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
|
@ -22,7 +22,7 @@ BEGIN
|
||||||
SET t.hasProblem = TRUE
|
SET t.hasProblem = TRUE
|
||||||
WHERE c.isFreezed;
|
WHERE c.isFreezed;
|
||||||
|
|
||||||
CALL ticket_setProblem('hasTicketRequest');
|
CALL ticket_setProblem('isFreezed');
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tmp.ticket;
|
DROP TEMPORARY TABLE tmp.ticket;
|
||||||
END$$
|
END$$
|
||||||
|
|
|
@ -19,7 +19,7 @@ BEGIN
|
||||||
WHERE t.id = vSelf;
|
WHERE t.id = vSelf;
|
||||||
|
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
|
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
|
||||||
SELECT vSelf ticketFk, vRisk hasProblem;
|
SELECT vSelf ticketFk, vHasRisk hasProblem;
|
||||||
|
|
||||||
CALL ticket_setProblem('hasRisk');
|
CALL ticket_setProblem('hasRisk');
|
||||||
|
|
||||||
|
|
|
@ -18,17 +18,17 @@ BEGIN
|
||||||
|
|
||||||
CALL buyUltimate(vWarehouseFk, vDated);
|
CALL buyUltimate(vWarehouseFk, vDated);
|
||||||
|
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
|
CREATE OR REPLACE TEMPORARY TABLE tmp.sale
|
||||||
SELECT s.id saleFk , MOD(s.quantity, b.`grouping`) hasProblem
|
SELECT s.id saleFk , MOD(s.quantity, b.`grouping`) hasProblem
|
||||||
FROM ticket t
|
FROM ticket t
|
||||||
JOIN sale s ON s.ticketFk = tl.ticketFk
|
JOIN sale s ON s.ticketFk = t.id
|
||||||
JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk
|
JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk
|
||||||
JOIN buy b ON b.id = bu.buyFk
|
JOIN buy b ON b.id = bu.buyFk
|
||||||
WHERE t.id = vSelf;
|
WHERE t.id = vSelf;
|
||||||
|
|
||||||
CALL sale_setProblem('hasRounding');
|
CALL sale_setProblem('hasRounding');
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tmp.ticket;
|
DROP TEMPORARY TABLE tmp.sale;
|
||||||
DROP TEMPORARY TABLE tmp.buyUltimate;
|
DROP TEMPORARY TABLE tmp.buyUltimate;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
|
@ -15,7 +15,7 @@ BEGIN
|
||||||
WITH tickets AS(
|
WITH tickets AS(
|
||||||
SELECT t.id ticketFk
|
SELECT t.id ticketFk
|
||||||
FROM vn.ticket t
|
FROM vn.ticket t
|
||||||
JOIN vn.sale s ON s.ticketFk = t.id
|
LEFT JOIN vn.sale s ON s.ticketFk = t.id
|
||||||
WHERE t.shipped >= util.midnight()
|
WHERE t.shipped >= util.midnight()
|
||||||
AND (s.itemFk = vItemFk OR vItemFk IS NULL)
|
AND (s.itemFk = vItemFk OR vItemFk IS NULL)
|
||||||
GROUP BY t.id
|
GROUP BY t.id
|
||||||
|
|
|
@ -227,5 +227,7 @@
|
||||||
"They're not your subordinate": "They're not your subordinate",
|
"They're not your subordinate": "They're not your subordinate",
|
||||||
"InvoiceIn is already booked": "InvoiceIn is already booked",
|
"InvoiceIn is already booked": "InvoiceIn is already booked",
|
||||||
"This workCenter is already assigned to this agency": "This workCenter is already assigned to this agency",
|
"This workCenter is already assigned to this agency": "This workCenter is already assigned to this agency",
|
||||||
|
"You can only have one PDA": "You can only have one PDA",
|
||||||
"Incoterms and Customs agent are required for a non UEE member": "Incoterms and Customs agent are required for a non UEE member"
|
"Incoterms and Customs agent are required for a non UEE member": "Incoterms and Customs agent are required for a non UEE member"
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -357,8 +357,7 @@
|
||||||
"This workCenter is already assigned to this agency": "Este centro de trabajo ya está asignado a esta agencia",
|
"This workCenter is already assigned to this agency": "Este centro de trabajo ya está asignado a esta agencia",
|
||||||
"Select ticket or client": "Elija un ticket o un client",
|
"Select ticket or client": "Elija un ticket o un client",
|
||||||
"It was not able to create the invoice": "No se pudo crear la factura",
|
"It was not able to create the invoice": "No se pudo crear la factura",
|
||||||
"This PDA is already assigned to another user": "This PDA is already assigned to another user",
|
|
||||||
"ticketCommercial": "El ticket {{ ticket }} para el vendedor {{ salesMan }} está en preparación. (mensaje generado automáticamente)",
|
"ticketCommercial": "El ticket {{ ticket }} para el vendedor {{ salesMan }} está en preparación. (mensaje generado automáticamente)",
|
||||||
"Incoterms and Customs agent are required for a non UEE member": "Se requieren Incoterms y agente de aduanas para un no miembro de la UEE",
|
"This PDA is already assigned to another user": "Este PDA ya está asignado a otro usuario",
|
||||||
"Cannot add holidays on this day": "No se pueden agregar vacaciones en este día"
|
"You can only have one PDA": "Solo puedes tener un PDA"
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,9 @@ module.exports = Self => {
|
||||||
Self.rewriteDbError(function(err) {
|
Self.rewriteDbError(function(err) {
|
||||||
if (err.code === 'ER_DUP_ENTRY')
|
if (err.code === 'ER_DUP_ENTRY')
|
||||||
return new UserError(`This PDA is already assigned to another user`);
|
return new UserError(`This PDA is already assigned to another user`);
|
||||||
|
|
||||||
|
if (err.code === 'ER_SIGNAL_EXCEPTION' && err.sqlMessage === 'You can only have one active PDA')
|
||||||
|
return new UserError(err.sqlMessage);
|
||||||
return err;
|
return err;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue