refactor: refs #6453 order_confirmWithUser #2694

Merged
guillermo merged 16 commits from 6453-orderConfirm into dev 2024-08-02 10:15:00 +00:00
1 changed files with 24 additions and 1 deletions
Showing only changes of commit 7e415181c2 - Show all commits

View File

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

esta linea no veig que es gaste

esta linea no veig que es gaste

Wow, molt ben vist

Wow, molt ben vist
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

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

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