fix: refs #7505 visible_refresh support warehouse null and added isComparative
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
5d2e9c6210
commit
a9aa47fef1
|
@ -20,10 +20,12 @@ proc:BEGIN
|
|||
CREATE OR REPLACE TEMPORARY TABLE tmp.itemVisible
|
||||
(PRIMARY KEY (item_id))
|
||||
ENGINE = MEMORY
|
||||
SELECT item_id, SUM(amount) stock, SUM(amount) visible
|
||||
FROM cache.stock
|
||||
WHERE (v_warehouse IS NULL OR warehouse_id = v_warehouse)
|
||||
GROUP BY item_id;
|
||||
SELECT s.item_id, SUM(s.amount) stock, SUM(s.amount) visible
|
||||
FROM cache.stock s
|
||||
JOIN warehouse w ON w.id = s.warehouse_id
|
||||
WHERE (v_warehouse IS NULL OR s.warehouse_id = v_warehouse)
|
||||
AND w.isComparative
|
||||
GROUP BY s.item_id;
|
||||
|
||||
-- Calculamos los movimientos confirmados de hoy
|
||||
CALL vn.item_calcVisible(NULL, v_warehouse);
|
||||
|
|
|
@ -22,7 +22,6 @@ BEGIN
|
|||
LEFT JOIN ticketState ts ON ts.ticketFk = i.ticketFk
|
||||
JOIN `state` s ON s.id = ts.stateFk
|
||||
JOIN warehouse w ON w.id = i.warehouseFk
|
||||
AND w.isComparative
|
||||
LEFT JOIN (
|
||||
SELECT DISTINCT st.saleFk
|
||||
FROM saleTracking st
|
||||
|
@ -34,26 +33,27 @@ BEGIN
|
|||
AND (vSelf IS NULL OR i.itemFk = vSelf)
|
||||
AND (s.isPicked OR i.reserved OR stPrevious.saleFk)
|
||||
AND i.shipped >= vDated AND i.shipped < vTomorrow
|
||||
AND w.isComparative
|
||||
UNION ALL
|
||||
SELECT iei.itemFk, iei.quantity
|
||||
FROM itemEntryIn iei
|
||||
JOIN warehouse w ON w.id = iei.warehouseInFk
|
||||
AND w.isComparative
|
||||
WHERE iei.isReceived
|
||||
AND iei.landed >= vDated AND iei.landed < vTomorrow
|
||||
AND (vWarehouseFk IS NULL OR iei.warehouseInFk = vWarehouseFk)
|
||||
AND (vSelf IS NULL OR iei.itemFk = vSelf)
|
||||
AND NOT iei.isVirtualStock
|
||||
AND w.isComparative
|
||||
UNION ALL
|
||||
SELECT ieo.itemFk, ieo.quantity
|
||||
FROM itemEntryOut ieo
|
||||
JOIN warehouse w ON w.id = ieo.warehouseOutFk
|
||||
AND w.isComparative
|
||||
WHERE ieo.isDelivered
|
||||
AND ieo.shipped >= vDated
|
||||
AND ieo.shipped < vTomorrow
|
||||
AND (vWarehouseFk IS NULL OR ieo.warehouseOutFk = vWarehouseFk)
|
||||
AND (vSelf IS NULL OR ieo.itemFk = vSelf)
|
||||
AND w.isComparative
|
||||
) t
|
||||
GROUP BY itemFk
|
||||
ON DUPLICATE KEY UPDATE
|
||||
|
|
Loading…
Reference in New Issue