fix: refs #7812 Added orders in item_getMinacum #2810

Merged
guillermo merged 3 commits from 7812-radarOrder into master 2024-08-02 10:01:57 +00:00
1 changed files with 11 additions and 11 deletions
Showing only changes of commit cc78355aad - Show all commits

View File

@ -8,7 +8,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_getMinacum`(
BEGIN
/**
* Cálculo del mínimo acumulado, para un item/almacén
* especificado, en caso de NULL para todo.
* especificado, en caso de NULL para todos.
*
* @param vWarehouseFk Id warehouse
* @param vDated Fecha inicio
@ -47,7 +47,7 @@ BEGIN
JOIN travel t ON t.id = e.travelFk
WHERE t.landed BETWEEN vDated AND vDatedTo
AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk)
AND !e.isExcludedFromAvailable
AND NOT e.isExcludedFromAvailable
AND b.quantity <> 0
AND (vItemFk IS NULL OR b.itemFk = vItemFk)
UNION ALL
@ -60,10 +60,10 @@ BEGIN
JOIN travel t ON t.id = e.travelFk
WHERE t.shipped BETWEEN vDated AND vDatedTo
AND (vWarehouseFk IS NULL OR t.warehouseOutFk = vWarehouseFk)
AND !e.isExcludedFromAvailable
AND NOT e.isExcludedFromAvailable
AND b.quantity <> 0
AND (vItemFk IS NULL OR b.itemFk = vItemFk)
AND !e.isRaid
AND NOT e.isRaid
UNION ALL
SELECT r.itemFk,
r.shipment,
@ -71,11 +71,11 @@ BEGIN
r.warehouseFk
FROM hedera.orderRow r
JOIN hedera.`order` o ON o.id = r.orderFk
JOIN vn.client c ON c.id = o.customer_id
JOIN client c ON c.id = o.customer_id
WHERE r.shipment BETWEEN vDated AND vDatedTo
AND (vWarehouseFk IS NULL OR r.warehouseFk = vWarehouseFk)
AND r.created >= (
SELECT SUBTIME(util.VN_NOW(), reserveTime)
SELECT util.VN_NOW() - INTERVAL TIME_TO_SEC(reserveTime) SECOND
FROM hedera.orderConfig
)
AND NOT o.confirmed
@ -89,11 +89,11 @@ BEGIN
CREATE OR REPLACE TEMPORARY TABLE tmp.itemMinacum
(INDEX(itemFk))
ENGINE = MEMORY
SELECT i.itemFk,
i.warehouseFk,
i.quantity amount
FROM tmp.itemAtp i
HAVING amount <> 0;
SELECT itemFk,
warehouseFk,
quantity amount
FROM tmp.itemAtp
WHERE quantity <> 0;
DROP TEMPORARY TABLE
tmp.itemAtp,