Hotfix ticketStateUpdate to ticket_setState
gitea/salix/pipeline/pr-master This commit looks good Details

This commit is contained in:
Carlos Andrés 2024-06-25 19:47:22 +02:00
parent 5bcdc57978
commit 75486ae743
3 changed files with 61 additions and 43 deletions

View File

@ -1,5 +1,7 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_DelayTruckSplit`(vTicketFk INT)
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_DelayTruckSplit`(
vTicketFk INT
)
BEGIN
/**
* Splita las lineas de ticket que no estan ubicadas

View File

@ -1,5 +1,8 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_cloneWeekly`(vDateFrom DATE, vDateTo DATE)
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_cloneWeekly`(
vDateFrom DATE,
vDateTo DATE
)
BEGIN
DECLARE vIsDone BOOL;
DECLARE vLanding DATE;
@ -41,7 +44,14 @@ BEGIN
DECLARE vMessage TEXT;
SET vIsDone = FALSE;
FETCH rsTicket INTO vTicketFk,vClientFk, vWarehouseFk, vCompanyFk, vAddressFk, vAgencyModeFk,vShipment;
FETCH rsTicket INTO
vTicketFk,
vClientFk,
vWarehouseFk,
vCompanyFk,
vAddressFk,
vAgencyModeFk,
vShipment;
IF vIsDone THEN
LEAVE myLoop;
@ -67,7 +77,7 @@ BEGIN
AND isDefaultAddress;
END IF;
CALL zone_getLanded(vShipment, vAddressFk, vAgencyModeFk, vWarehouseFk,FALSE);
CALL zone_getLanded(vShipment, vAddressFk, vAgencyModeFk, vWarehouseFk, FALSE);
SET vLanding = NULL;
SELECT landed INTO vLanding FROM tmp.zoneGetLanded LIMIT 1;
@ -88,8 +98,14 @@ BEGIN
SET clonedFrom = vTicketFk
WHERE id = vNewTicket;
INSERT INTO sale (ticketFk, itemFk, concept, quantity, price,
discount, priceFixed, isPriceFixed)
INSERT INTO sale (ticketFk,
itemFk,
concept,
quantity,
price,
discount,
priceFixed,
isPriceFixed)
SELECT vNewTicket,
saleOrig.itemFk,
saleOrig.concept,

View File

@ -1,5 +1,9 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_split`(vTicketFk INT, vTicketFutureFk INT, vDated DATE)
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_split`(
vTicketFk INT,
vTicketFutureFk INT,
vDated DATE
)
proc:BEGIN
/**
* Mueve las lineas con problemas a otro ticket existente o a uno nuevo.
@ -17,7 +21,7 @@ proc:BEGIN
FROM tmp.salesToSplit
WHERE ticketFk = vTicketFk;
SELECT count(*) INTO vTotalLines
SELECT COUNT(*) INTO vTotalLines
FROM sale s
WHERE s.ticketFk = vTicketFk;
@ -25,30 +29,26 @@ proc:BEGIN
-- Ticket completo
IF vHasFullProblem THEN
UPDATE ticket
SET landed = vDated + INTERVAL 1 DAY,
shipped = vDated,
nickname = CONCAT('(',DAY(util.VN_CURDATE()),') ', nickname )
nickname = CONCAT('(',DAY(util.VN_CURDATE()),') ', nickname)
WHERE id = vTicketFk;
SELECT "moved" message, NULL ticketFuture;
SELECT 'moved' message, NULL ticketFuture;
LEAVE proc;
END IF;
-- Ticket a futuro existe
IF vTicketFutureFk THEN
UPDATE sale s
JOIN tmp.salesToSplit ss ON s.id = ss.saleFk
SET s.ticketFk = vTicketFutureFk,
s.concept = CONCAT('(s) ', s.concept)
WHERE ss.ticketFk = vTicketFk;
SELECT "future" message, NULL ticketFuture;
SELECT 'future' message, NULL ticketFuture;
LEAVE proc;
END IF;
-- Ticket nuevo
@ -71,6 +71,6 @@ proc:BEGIN
CALL ticket_setState(vTicketFutureFk, 'FIXING');
SELECT "new" message,vTicketFutureFk ticketFuture;
SELECT 'new' message, vTicketFutureFk ticketFuture;
END$$
DELIMITER ;