Merge branch 'master' into hotFix_workerNew_countryFk
gitea/salix/pipeline/pr-master This commit looks good
Details
gitea/salix/pipeline/pr-master This commit looks good
Details
This commit is contained in:
commit
aa3fbf0cb4
|
@ -19,21 +19,20 @@ BEGIN
|
||||||
|
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tmp.sale
|
CREATE OR REPLACE TEMPORARY TABLE tmp.sale
|
||||||
(saleFk INT PRIMARY KEY)
|
(saleFk INT PRIMARY KEY)
|
||||||
SELECT
|
SELECT s.ticketFk,
|
||||||
s.ticketFk,
|
s.id saleFk,
|
||||||
s.id saleFk,
|
s.itemFk,
|
||||||
s.itemFk,
|
s.concept,
|
||||||
s.concept,
|
s.quantity,
|
||||||
s.quantity,
|
MAKETIME(pb.HH,pb.mm,0) etd,
|
||||||
MAKETIME(pb.HH,pb.mm,0) etd,
|
pb.routeFk,
|
||||||
pb.routeFk,
|
FLOOR(s.quantity / IF(i.isBoxPickingMode, ish.packing, i.packingOut)) stickers,
|
||||||
FLOOR(s.quantity / IF(i.isBoxPickingMode, ish.packing, i.packingOut)) stickers,
|
IF(i.isBoxPickingMode, ish.packing, i.packingOut) packing,
|
||||||
IF(i.isBoxPickingMode, ish.packing, i.packingOut) packing,
|
IF(pa.isPackageReturnable, pc.defaultBigPackageFk, b.packagingFk) packagingFk
|
||||||
b.packagingFk
|
|
||||||
FROM sale s
|
FROM sale s
|
||||||
JOIN item i ON i.id = s.itemFk
|
JOIN item i ON i.id = s.itemFk
|
||||||
JOIN itemShelving ish ON ish.itemFk = s.itemFk
|
JOIN itemShelving ish ON ish.itemFk = s.itemFk
|
||||||
LEFT JOIN ( SELECT iss.itemShelvingFk,
|
LEFT JOIN ( SELECT iss.itemShelvingFk,
|
||||||
s.itemFk,
|
s.itemFk,
|
||||||
SUM(iss.quantity) reserve
|
SUM(iss.quantity) reserve
|
||||||
FROM itemShelvingSale iss
|
FROM itemShelvingSale iss
|
||||||
|
@ -52,6 +51,8 @@ BEGIN
|
||||||
LEFT JOIN ticketState ts ON ts.ticketFk = s.ticketFk
|
LEFT JOIN ticketState ts ON ts.ticketFk = s.ticketFk
|
||||||
LEFT JOIN cache.last_buy lb ON lb.item_id = i.id AND lb.warehouse_id = vWarehouseFk
|
LEFT JOIN cache.last_buy lb ON lb.item_id = i.id AND lb.warehouse_id = vWarehouseFk
|
||||||
LEFT JOIN buy b ON b.id = lb.buy_id
|
LEFT JOIN buy b ON b.id = lb.buy_id
|
||||||
|
LEFT JOIN packaging pa ON pa.id = b.packagingFk
|
||||||
|
JOIN packagingConfig pc
|
||||||
WHERE IF(i.isBoxPickingMode, ish.packing, i.packingOut)
|
WHERE IF(i.isBoxPickingMode, ish.packing, i.packingOut)
|
||||||
<= LEAST(s.quantity, ish.visible - IFNULL(tISS.reserve,0))
|
<= LEAST(s.quantity, ish.visible - IFNULL(tISS.reserve,0))
|
||||||
AND NOT pb.problem
|
AND NOT pb.problem
|
||||||
|
|
|
@ -44,14 +44,14 @@ BEGIN
|
||||||
t.shipped,
|
t.shipped,
|
||||||
IFNULL(a.hasDailyInvoice, co.hasDailyInvoice),
|
IFNULL(a.hasDailyInvoice, co.hasDailyInvoice),
|
||||||
w.isManaged,
|
w.isManaged,
|
||||||
c.hasToInvoice
|
c.hasToInvoice
|
||||||
INTO vClientFk,
|
INTO vClientFk,
|
||||||
vIsTaxDataChecked,
|
vIsTaxDataChecked,
|
||||||
vCompanyFk,
|
vCompanyFk,
|
||||||
vShipped,
|
vShipped,
|
||||||
vHasDailyInvoice,
|
vHasDailyInvoice,
|
||||||
vWithPackage,
|
vWithPackage,
|
||||||
vHasToInvoice
|
vHasToInvoice
|
||||||
FROM ticket t
|
FROM ticket t
|
||||||
JOIN `client` c ON c.id = t.clientFk
|
JOIN `client` c ON c.id = t.clientFk
|
||||||
JOIN province p ON p.id = c.provinceFk
|
JOIN province p ON p.id = c.provinceFk
|
||||||
|
@ -64,8 +64,12 @@ BEGIN
|
||||||
(SELECT vCurTicketFk, p.id, COUNT(*)
|
(SELECT vCurTicketFk, p.id, COUNT(*)
|
||||||
FROM expedition e
|
FROM expedition e
|
||||||
JOIN packaging p ON p.id = e.packagingFk
|
JOIN packaging p ON p.id = e.packagingFk
|
||||||
|
JOIN ticket t ON t.id = e.ticketFk
|
||||||
|
LEFT JOIN agencyMode am ON am.id = t.agencyModeFk
|
||||||
|
LEFT JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk
|
||||||
WHERE e.ticketFk = vCurTicketFk AND p.isPackageReturnable
|
WHERE e.ticketFk = vCurTicketFk AND p.isPackageReturnable
|
||||||
AND vWithPackage
|
AND vWithPackage
|
||||||
|
AND NOT dm.`code`= 'PICKUP'
|
||||||
GROUP BY p.itemFk);
|
GROUP BY p.itemFk);
|
||||||
|
|
||||||
-- No retornables o no catalogados
|
-- No retornables o no catalogados
|
||||||
|
|
Loading…
Reference in New Issue