refactor: refs #6453 order_confirmWithUser #2694
|
@ -36,6 +36,7 @@ BEGIN
|
|||
DECLARE vIsTaxDataChecked BOOL;
|
||||
DECLARE vAvailable INT;
|
||||
DECLARE vItemPackingTypeFk VARCHAR(1);
|
||||
DECLARE vCountDistinctItemPackingTypeFk INT;
|
||||
|
||||
DECLARE vDates CURSOR FOR
|
||||
SELECT zgs.shipped, r.warehouseFk
|
||||
|
@ -54,7 +55,7 @@ BEGIN
|
|||
WHERE o.id = vSelf
|
||||
AND r.warehouseFk = vWarehouseFk
|
||||
AND r.amount
|
||||
ORDER BY i.itemPackingTypeFk DESC;
|
||||
ORDER BY i.itemPackingTypeFk DESC; -- El último siempre NULL!!
|
||||
|
||||
DECLARE vRows CURSOR FOR
|
||||
SELECT r.id,
|
||||
|
@ -155,6 +156,28 @@ BEGIN
|
|||
LEAVE lDistinctItemPackingType;
|
||||
END IF;
|
||||
|
||||
IF vItemPackingTypeFk IS NULL THEN
|
||||
SELECT COUNT(*) INTO vCountDistinctItemPackingTypeFk
|
||||
FROM tTicketByItemPackingType;
|
||||
|
||||
CASE
|
||||
WHEN vCountDistinctItemPackingTypeFk = 1 THEN
|
||||
guillermo marked this conversation as resolved
Outdated
|
||||
INSERT INTO tTicketByItemPackingType
|
||||
SET itemPackingTypeFk = vItemPackingTypeFk,
|
||||
ticketFk = (SELECT ticketFk FROM tTicketByItemPackingType);
|
||||
LEAVE lDistinctItemPackingType;
|
||||
WHEN vCountDistinctItemPackingTypeFk > 1 THEN
|
||||
INSERT INTO tTicketByItemPackingType
|
||||
SET itemPackingTypeFk = vItemPackingTypeFk,
|
||||
ticketFk = (
|
||||
SELECT ticketFk
|
||||
FROM tTicketByItemPackingType
|
||||
WHERE itemPackingTypeFk = 'H'
|
||||
);
|
||||
LEAVE lDistinctItemPackingType;
|
||||
guillermo marked this conversation as resolved
Outdated
jgallego
commented
Este enfoque te un problema: Este enfoque te un problema:
si el confirma una order V,H
i ja existia un ticket H,V encara que es lo mateix, com l'ordre està canviat. No l'agafarà com a igual i crearà un altre,
Li he preguntat a Claude per si t'ajuda..https://claude.ai/chat/9e3efec7-761c-4482-a0df-e0e1fed1c7f2
|
||||
END CASE;
|
||||
END IF;
|
||||
|
||||
WITH tPrevia AS (
|
||||
SELECT DISTINCT s.ticketFk
|
||||
FROM vn.sale s
|
||||
|
|
Loading…
Reference in New Issue
esta linea no veig que es gaste
Wow, molt ben vist