Merge pull request 'test' (!2504) from test into dev
gitea/salix/pipeline/head This commit looks good Details

Reviewed-on: #2504
Reviewed-by: Pablo Natek <pablone@verdnatura.es>
This commit is contained in:
Carlos Andrés 2024-05-23 11:42:23 +00:00
commit 35a583d6d8
9 changed files with 26 additions and 18 deletions

View File

@ -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 ticket t FROM (
JOIN sale s ON s.ticketFk = t.id SELECT s.id saleFk
LEFT JOIN saleComponent sc ON sc.saleFk = s.id FROM ticket t
WHERE t.shipped >= util.midnight() JOIN sale s ON s.ticketFk = t.id
AND (vComponentFk IS NULL OR sc.componentFk = vComponentFk); LEFT JOIN saleComponent sc ON sc.saleFk = s.id
WHERE t.shipped >= util.midnight()
AND (vComponentFk IS NULL OR sc.componentFk = vComponentFk)
GROUP BY s.id) sub;
CALL sale_setProblem('hasComponentLack'); CALL sale_setProblem('hasComponentLack');

View File

@ -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 ;

View File

@ -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$$

View File

@ -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');

View File

@ -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 ;

View File

@ -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

View File

@ -226,5 +226,6 @@
"This password can only be changed by the user themselves": "This password can only be changed by the user themselves", "This password can only be changed by the user themselves": "This password can only be changed by the user themselves",
"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"
} }

View File

@ -357,6 +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)" "This PDA is already assigned to another user": "Este PDA ya está asignado a otro usuario",
"You can only have one PDA": "Solo puedes tener un PDA"
} }

View File

@ -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;
}); });
}; };