Merge branch 'test' into dev
This commit is contained in:
commit
b6b3da0771
|
@ -15,14 +15,13 @@ BEGIN
|
||||||
* @param vDated Fecha
|
* @param vDated Fecha
|
||||||
* @param vShowType Mostrar tipos
|
* @param vShowType Mostrar tipos
|
||||||
*/
|
*/
|
||||||
DECLARE vCalcFk INT;
|
DECLARE vAvailableCalcFk INT;
|
||||||
|
DECLARE vVisibleCalcFk INT;
|
||||||
DECLARE vTypeFk INT;
|
DECLARE vTypeFk INT;
|
||||||
DECLARE vPriority INT DEFAULT 1;
|
DECLARE vPriority INT DEFAULT 1;
|
||||||
|
|
||||||
CALL cache.available_refresh(vCalcFk, FALSE, vWarehouseFk, vDated);
|
CALL cache.available_refresh(vAvailableCalcFk, FALSE, vWarehouseFk, vDated);
|
||||||
|
CALL cache.visible_refresh(vVisibleCalcFk, FALSE, vWarehouseFk);
|
||||||
-- Añadido temporalmente para que no se cuelgue la db
|
|
||||||
SET vShowType = TRUE;
|
|
||||||
|
|
||||||
WITH itemTags AS (
|
WITH itemTags AS (
|
||||||
SELECT i.id,
|
SELECT i.id,
|
||||||
|
@ -65,21 +64,21 @@ BEGIN
|
||||||
WHEN b.groupingMode = 'packing' THEN b.packing
|
WHEN b.groupingMode = 'packing' THEN b.packing
|
||||||
ELSE 1
|
ELSE 1
|
||||||
END AS minQuantity,
|
END AS minQuantity,
|
||||||
iss.visible located,
|
v.visible located,
|
||||||
b.price2
|
b.price2
|
||||||
FROM vn.item i
|
FROM vn.item i
|
||||||
JOIN cache.available a ON a.item_id = i.id
|
JOIN cache.available a ON a.item_id = i.id
|
||||||
AND a.calc_id = vCalcFk
|
AND a.calc_id = vAvailableCalcFk
|
||||||
|
LEFT JOIN cache.visible v ON v.item_id = i.id
|
||||||
|
AND v.calc_id = vVisibleCalcFk
|
||||||
|
LEFT JOIN cache.last_buy lb ON lb.item_id = i.id
|
||||||
|
AND lb.warehouse_id = vWarehouseFk
|
||||||
LEFT JOIN vn.itemProposal ip ON ip.mateFk = i.id
|
LEFT JOIN vn.itemProposal ip ON ip.mateFk = i.id
|
||||||
AND ip.itemFk = vSelf
|
AND ip.itemFk = vSelf
|
||||||
LEFT JOIN vn.itemTag it ON it.itemFk = i.id
|
LEFT JOIN vn.itemTag it ON it.itemFk = i.id
|
||||||
AND it.priority = vPriority
|
AND it.priority = vPriority
|
||||||
LEFT JOIN vn.tag t ON t.id = it.tagFk
|
LEFT JOIN vn.tag t ON t.id = it.tagFk
|
||||||
LEFT JOIN cache.last_buy lb ON lb.item_id = i.id
|
|
||||||
AND lb.warehouse_id = vWarehouseFk
|
|
||||||
LEFT JOIN vn.buy b ON b.id = lb.buy_id
|
LEFT JOIN vn.buy b ON b.id = lb.buy_id
|
||||||
LEFT JOIN vn.itemShelvingStock iss ON iss.itemFk = i.id
|
|
||||||
AND iss.warehouseFk = vWarehouseFk
|
|
||||||
JOIN itemTags its
|
JOIN itemTags its
|
||||||
WHERE a.available > 0
|
WHERE a.available > 0
|
||||||
AND (i.typeFk = its.typeFk OR NOT vShowType)
|
AND (i.typeFk = its.typeFk OR NOT vShowType)
|
||||||
|
|
Loading…
Reference in New Issue