fix: refs #6861 duplicatedTicketsInReserve #3053
|
@ -21,9 +21,8 @@ BEGIN
|
||||||
SELECT tob.ticketFk, tob.description
|
SELECT tob.ticketFk, tob.description
|
||||||
FROM vn.ticketObservation tob
|
FROM vn.ticketObservation tob
|
||||||
JOIN vn.ticketCollection tc ON tc.ticketFk = tob.ticketFk
|
JOIN vn.ticketCollection tc ON tc.ticketFk = tob.ticketFk
|
||||||
LEFT JOIN vn.observationType ot ON ot.id = tob.observationTypeFk
|
JOIN vn.observationType ot ON ot.id = tob.observationTypeFk AND ot.`code` = 'itemPicker'
|
||||||
WHERE ot.`code` = 'itemPicker'
|
WHERE tc.collectionFk = vParamFk OR tc.ticketFk = vParamFk
|
||||||
AND tc.collectionFk = vParamFk
|
|
||||||
)
|
)
|
||||||
SELECT t.id ticketFk,
|
SELECT t.id ticketFk,
|
||||||
IF(!(vItemPackingTypeFk <=> 'V'), cc.code, CONCAT(SUBSTRING('ABCDEFGH', tc.wagon, 1), '-', tc.`level`)) `level`,
|
IF(!(vItemPackingTypeFk <=> 'V'), cc.code, CONCAT(SUBSTRING('ABCDEFGH', tc.wagon, 1), '-', tc.`level`)) `level`,
|
||||||
|
|
|
@ -12,15 +12,17 @@ proc: BEGIN
|
||||||
DECLARE vHasSalesPicked BOOL;
|
DECLARE vHasSalesPicked BOOL;
|
||||||
|
|
||||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||||
BEGIN
|
BEGIN
|
||||||
ROLLBACK;
|
ROLLBACK;
|
||||||
RESIGNAL;
|
RESIGNAL;
|
||||||
END;
|
END;
|
||||||
|
|
||||||
|
START TRANSACTION;
|
||||||
|
|
||||||
SELECT iss.saleFk INTO vSaleFk
|
SELECT iss.saleFk INTO vSaleFk
|
||||||
FROM itemShelvingSale iss
|
FROM itemShelvingSale iss
|
||||||
JOIN sale s ON s.id = iss.saleFk
|
JOIN sale s ON s.id = iss.saleFk
|
||||||
WHERE iss.id = vSelf AND s.isAdded ;
|
WHERE iss.id = vSelf AND s.isAdded;
|
||||||
|
|
||||||
IF vSaleFk IS NULL THEN
|
IF vSaleFk IS NULL THEN
|
||||||
CALL util.throw('The sale can not be deleted');
|
CALL util.throw('The sale can not be deleted');
|
||||||
|
@ -31,11 +33,9 @@ proc: BEGIN
|
||||||
WHERE saleFk = vSaleFk AND isPicked;
|
WHERE saleFk = vSaleFk AND isPicked;
|
||||||
|
|
||||||
IF vHasSalesPicked THEN
|
IF vHasSalesPicked THEN
|
||||||
CALL util.throw('The sale can not be deleted with sales picked');
|
CALL util.throw('A sale with picked sales cannot be deleted');
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
START TRANSACTION;
|
|
||||||
|
|
||||||
UPDATE itemShelvingSale iss
|
UPDATE itemShelvingSale iss
|
||||||
JOIN itemShelving ish ON ish.id = iss.itemShelvingFk
|
JOIN itemShelving ish ON ish.id = iss.itemShelvingFk
|
||||||
SET ish.available = ish.available + iss.quantity
|
SET ish.available = ish.available + iss.quantity
|
Loading…
Reference in New Issue