refactor: refs #6453 order_confirmWithUser #2694
|
@ -136,11 +136,11 @@ BEGIN
|
|||
FROM vn.ticket t
|
||||
JOIN vn.alertLevel al ON al.code = 'FREE'
|
||||
LEFT JOIN tPrevia tp ON tp.ticketFk = t.id
|
||||
LEFT JOIN vn.ticketState tls on tls.ticketFk = t.id
|
||||
LEFT JOIN vn.ticketState tls ON tls.ticketFk = t.id
|
||||
JOIN hedera.`order` o ON o.address_id = t.addressFk
|
||||
AND t.shipped BETWEEN vShipment AND vShipmentDayEnd
|
||||
AND t.warehouseFk = vWarehouseFk
|
||||
AND o.date_send = t.landed
|
||||
AND t.shipped BETWEEN vShipment AND vShipmentDayEnd
|
||||
WHERE o.id = vSelf
|
||||
AND t.refFk IS NULL
|
||||
AND tp.ticketFk IS NULL
|
||||
|
@ -150,7 +150,9 @@ BEGIN
|
|||
-- Comprobamos si hay un ticket de previa disponible
|
||||
IF vTicketFk IS NULL THEN
|
||||
WITH tItemPackingTypeOrder AS (
|
||||
SELECT GROUP_CONCAT(DISTINCT i.itemPackingTypeFk) distinctItemPackingTypes,
|
||||
SELECT GROUP_CONCAT(
|
||||
DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk
|
||||
) distinctItemPackingTypes,
|
||||
o.address_id
|
||||
FROM vn.item i
|
||||
JOIN orderRow oro ON oro.itemFk = i.id
|
||||
|
@ -159,16 +161,20 @@ BEGIN
|
|||
),
|
||||
tItemPackingTypeTicket AS (
|
||||
SELECT t.id,
|
||||
GROUP_CONCAT(DISTINCT i.itemPackingTypeFk) distinctItemPackingTypes
|
||||
GROUP_CONCAT(
|
||||
guillermo marked this conversation as resolved
Outdated
|
||||
DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk
|
||||
) distinctItemPackingTypes
|
||||
FROM vn.ticket t
|
||||
JOIN vn.alertLevel al ON al.code = 'ON_PREVIOUS'
|
||||
JOIN vn.ticketState tls ON tls.ticketFk = t.id
|
||||
JOIN vn.alertLevel al ON al.id = tls.alertLevel
|
||||
JOIN vn.sale s ON s.ticketFk = t.id
|
||||
JOIN vn.item i ON i.id = s.itemFk
|
||||
JOIN tItemPackingTypeOrder ipto
|
||||
WHERE t.refFk IS NULL
|
||||
AND t.shipped BETWEEN vShipment AND vShipmentDayEnd
|
||||
WHERE t.shipped BETWEEN vShipment AND vShipmentDayEnd
|
||||
AND t.refFk IS NULL
|
||||
AND t.warehouseFk = vWarehouseFk
|
||||
AND t.addressFk = ipto.address_id
|
||||
AND al.code = 'ON_PREVIOUS'
|
||||
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
|
||||
GROUP BY t.id
|
||||
)
|
||||
SELECT iptt.id INTO vTicketFk
|
||||
|
|
Loading…
Reference in New Issue
esta linea no veig que es gaste
Wow, molt ben vist