feat: refs #6453 Requested changes
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Guillermo Bonet 2024-08-02 07:58:45 +02:00
parent b6abcbe090
commit b56260af36
1 changed files with 13 additions and 7 deletions

View File

@ -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(
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'
GROUP BY t.id
)
SELECT iptt.id INTO vTicketFk