Hotfix ticketStateUpdate to ticket_setState
gitea/salix/pipeline/pr-master This commit looks good
Details
gitea/salix/pipeline/pr-master This commit looks good
Details
This commit is contained in:
parent
5bcdc57978
commit
75486ae743
|
@ -1,5 +1,7 @@
|
||||||
DELIMITER $$
|
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
|
BEGIN
|
||||||
/**
|
/**
|
||||||
* Splita las lineas de ticket que no estan ubicadas
|
* Splita las lineas de ticket que no estan ubicadas
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
DELIMITER $$
|
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
|
BEGIN
|
||||||
DECLARE vIsDone BOOL;
|
DECLARE vIsDone BOOL;
|
||||||
DECLARE vLanding DATE;
|
DECLARE vLanding DATE;
|
||||||
|
@ -39,9 +42,16 @@ BEGIN
|
||||||
DECLARE vIsDuplicateMail BOOL;
|
DECLARE vIsDuplicateMail BOOL;
|
||||||
DECLARE vSubject VARCHAR(150);
|
DECLARE vSubject VARCHAR(150);
|
||||||
DECLARE vMessage TEXT;
|
DECLARE vMessage TEXT;
|
||||||
|
|
||||||
SET vIsDone = FALSE;
|
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
|
IF vIsDone THEN
|
||||||
LEAVE myLoop;
|
LEAVE myLoop;
|
||||||
|
@ -67,7 +77,7 @@ BEGIN
|
||||||
AND isDefaultAddress;
|
AND isDefaultAddress;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
CALL zone_getLanded(vShipment, vAddressFk, vAgencyModeFk, vWarehouseFk,FALSE);
|
CALL zone_getLanded(vShipment, vAddressFk, vAgencyModeFk, vWarehouseFk, FALSE);
|
||||||
SET vLanding = NULL;
|
SET vLanding = NULL;
|
||||||
SELECT landed INTO vLanding FROM tmp.zoneGetLanded LIMIT 1;
|
SELECT landed INTO vLanding FROM tmp.zoneGetLanded LIMIT 1;
|
||||||
|
|
||||||
|
@ -88,16 +98,22 @@ BEGIN
|
||||||
SET clonedFrom = vTicketFk
|
SET clonedFrom = vTicketFk
|
||||||
WHERE id = vNewTicket;
|
WHERE id = vNewTicket;
|
||||||
|
|
||||||
INSERT INTO sale (ticketFk, itemFk, concept, quantity, price,
|
INSERT INTO sale (ticketFk,
|
||||||
discount, priceFixed, isPriceFixed)
|
itemFk,
|
||||||
|
concept,
|
||||||
|
quantity,
|
||||||
|
price,
|
||||||
|
discount,
|
||||||
|
priceFixed,
|
||||||
|
isPriceFixed)
|
||||||
SELECT vNewTicket,
|
SELECT vNewTicket,
|
||||||
saleOrig.itemFk,
|
saleOrig.itemFk,
|
||||||
saleOrig.concept,
|
saleOrig.concept,
|
||||||
saleOrig.quantity,
|
saleOrig.quantity,
|
||||||
saleOrig.price,
|
saleOrig.price,
|
||||||
saleOrig.discount,
|
saleOrig.discount,
|
||||||
saleOrig.priceFixed,
|
saleOrig.priceFixed,
|
||||||
saleOrig.isPriceFixed
|
saleOrig.isPriceFixed
|
||||||
FROM sale saleOrig
|
FROM sale saleOrig
|
||||||
WHERE saleOrig.ticketFk = vTicketFk;
|
WHERE saleOrig.ticketFk = vTicketFk;
|
||||||
|
|
||||||
|
@ -123,20 +139,20 @@ BEGIN
|
||||||
,attenderFk,
|
,attenderFk,
|
||||||
ticketFk)
|
ticketFk)
|
||||||
SELECT description,
|
SELECT description,
|
||||||
ordered,
|
ordered,
|
||||||
shipped,
|
shipped,
|
||||||
quantity,
|
quantity,
|
||||||
price,
|
price,
|
||||||
itemFk,
|
itemFk,
|
||||||
clientFk,
|
clientFk,
|
||||||
response,
|
response,
|
||||||
total,
|
total,
|
||||||
buyed,
|
buyed,
|
||||||
requesterFk,
|
requesterFk,
|
||||||
attenderFk,
|
attenderFk,
|
||||||
vNewTicket
|
vNewTicket
|
||||||
FROM ticketRequest
|
FROM ticketRequest
|
||||||
WHERE ticketFk =vTicketFk;
|
WHERE ticketFk =vTicketFk;
|
||||||
|
|
||||||
SELECT id INTO vSalesPersonFK
|
SELECT id INTO vSalesPersonFK
|
||||||
FROM observationType
|
FROM observationType
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
DELIMITER $$
|
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
|
proc:BEGIN
|
||||||
/**
|
/**
|
||||||
* Mueve las lineas con problemas a otro ticket existente o a uno nuevo.
|
* Mueve las lineas con problemas a otro ticket existente o a uno nuevo.
|
||||||
|
@ -17,7 +21,7 @@ proc:BEGIN
|
||||||
FROM tmp.salesToSplit
|
FROM tmp.salesToSplit
|
||||||
WHERE ticketFk = vTicketFk;
|
WHERE ticketFk = vTicketFk;
|
||||||
|
|
||||||
SELECT count(*) INTO vTotalLines
|
SELECT COUNT(*) INTO vTotalLines
|
||||||
FROM sale s
|
FROM sale s
|
||||||
WHERE s.ticketFk = vTicketFk;
|
WHERE s.ticketFk = vTicketFk;
|
||||||
|
|
||||||
|
@ -25,52 +29,48 @@ proc:BEGIN
|
||||||
|
|
||||||
-- Ticket completo
|
-- Ticket completo
|
||||||
IF vHasFullProblem THEN
|
IF vHasFullProblem THEN
|
||||||
|
|
||||||
UPDATE ticket
|
UPDATE ticket
|
||||||
SET landed = vDated + INTERVAL 1 DAY,
|
SET landed = vDated + INTERVAL 1 DAY,
|
||||||
shipped = vDated,
|
shipped = vDated,
|
||||||
nickname = CONCAT('(',DAY(util.VN_CURDATE()),') ', nickname )
|
nickname = CONCAT('(',DAY(util.VN_CURDATE()),') ', nickname)
|
||||||
WHERE id = vTicketFk;
|
WHERE id = vTicketFk;
|
||||||
|
|
||||||
SELECT "moved" message, NULL ticketFuture;
|
SELECT 'moved' message, NULL ticketFuture;
|
||||||
LEAVE proc;
|
LEAVE proc;
|
||||||
|
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
-- Ticket a futuro existe
|
-- Ticket a futuro existe
|
||||||
IF vTicketFutureFk THEN
|
IF vTicketFutureFk THEN
|
||||||
|
|
||||||
UPDATE sale s
|
UPDATE sale s
|
||||||
JOIN tmp.salesToSplit ss ON s.id = ss.saleFk
|
JOIN tmp.salesToSplit ss ON s.id = ss.saleFk
|
||||||
SET s.ticketFk = vTicketFutureFk,
|
SET s.ticketFk = vTicketFutureFk,
|
||||||
s.concept = CONCAT('(s) ', s.concept)
|
s.concept = CONCAT('(s) ', s.concept)
|
||||||
WHERE ss.ticketFk = vTicketFk;
|
WHERE ss.ticketFk = vTicketFk;
|
||||||
|
|
||||||
SELECT "future" message, NULL ticketFuture;
|
SELECT 'future' message, NULL ticketFuture;
|
||||||
LEAVE proc;
|
LEAVE proc;
|
||||||
|
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
-- Ticket nuevo
|
-- Ticket nuevo
|
||||||
CALL ticket_Clone(vTicketFk, vTicketFutureFk);
|
CALL ticket_Clone(vTicketFk, vTicketFutureFk);
|
||||||
|
|
||||||
UPDATE ticket t
|
UPDATE ticket t
|
||||||
JOIN productionConfig pc
|
JOIN productionConfig pc
|
||||||
SET t.routeFk = IF(t.shipped = vDated , t.routeFk, NULL),
|
SET t.routeFk = IF(t.shipped = vDated , t.routeFk, NULL),
|
||||||
t.landed = vDated + INTERVAL 1 DAY,
|
t.landed = vDated + INTERVAL 1 DAY,
|
||||||
t.shipped = vDated,
|
t.shipped = vDated,
|
||||||
t.agencyModeFk = pc.defautlAgencyMode,
|
t.agencyModeFk = pc.defautlAgencyMode,
|
||||||
t.zoneFk = pc.defaultZone
|
t.zoneFk = pc.defaultZone
|
||||||
WHERE t.id = vTicketFutureFk;
|
WHERE t.id = vTicketFutureFk;
|
||||||
|
|
||||||
UPDATE sale s
|
UPDATE sale s
|
||||||
JOIN tmp.salesToSplit sts ON sts.saleFk = s.id
|
JOIN tmp.salesToSplit sts ON sts.saleFk = s.id
|
||||||
SET s.ticketFk = vTicketFutureFk,
|
SET s.ticketFk = vTicketFutureFk,
|
||||||
s.concept = CONCAT('(s) ', s.concept)
|
s.concept = CONCAT('(s) ', s.concept)
|
||||||
WHERE sts.ticketFk = vTicketFk;
|
WHERE sts.ticketFk = vTicketFk;
|
||||||
|
|
||||||
CALL ticket_setState(vTicketFutureFk, 'FIXING');
|
CALL ticket_setState(vTicketFutureFk, 'FIXING');
|
||||||
|
|
||||||
SELECT "new" message,vTicketFutureFk ticketFuture;
|
SELECT 'new' message, vTicketFutureFk ticketFuture;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
Loading…
Reference in New Issue