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 BEGIN
/** /**
* Cálculo del mínimo acumulado, para un item/almacén * 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.
guillermo marked this conversation as resolved Outdated

todos

todos
* *
* @param vWarehouseFk Id warehouse * @param vWarehouseFk Id warehouse
* @param vDated Fecha inicio * @param vDated Fecha inicio
@ -47,7 +47,7 @@ BEGIN
JOIN travel t ON t.id = e.travelFk JOIN travel t ON t.id = e.travelFk
WHERE t.landed BETWEEN vDated AND vDatedTo WHERE t.landed BETWEEN vDated AND vDatedTo
AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk) AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk)
AND !e.isExcludedFromAvailable AND NOT e.isExcludedFromAvailable
guillermo marked this conversation as resolved Outdated

NOT

NOT
AND b.quantity <> 0 AND b.quantity <> 0
AND (vItemFk IS NULL OR b.itemFk = vItemFk) AND (vItemFk IS NULL OR b.itemFk = vItemFk)
UNION ALL UNION ALL
@ -60,10 +60,10 @@ BEGIN
JOIN travel t ON t.id = e.travelFk JOIN travel t ON t.id = e.travelFk
WHERE t.shipped BETWEEN vDated AND vDatedTo WHERE t.shipped BETWEEN vDated AND vDatedTo
AND (vWarehouseFk IS NULL OR t.warehouseOutFk = vWarehouseFk) AND (vWarehouseFk IS NULL OR t.warehouseOutFk = vWarehouseFk)
AND !e.isExcludedFromAvailable AND NOT e.isExcludedFromAvailable
AND b.quantity <> 0 AND b.quantity <> 0
AND (vItemFk IS NULL OR b.itemFk = vItemFk) AND (vItemFk IS NULL OR b.itemFk = vItemFk)
AND !e.isRaid AND NOT e.isRaid
guillermo marked this conversation as resolved Outdated

NOT

NOT
UNION ALL UNION ALL
SELECT r.itemFk, SELECT r.itemFk,
r.shipment, r.shipment,
@ -71,11 +71,11 @@ BEGIN
r.warehouseFk r.warehouseFk
FROM hedera.orderRow r FROM hedera.orderRow r
JOIN hedera.`order` o ON o.id = r.orderFk 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
guillermo marked this conversation as resolved Outdated

Eliminar esquema vn

Eliminar esquema vn
WHERE r.shipment BETWEEN vDated AND vDatedTo WHERE r.shipment BETWEEN vDated AND vDatedTo
AND (vWarehouseFk IS NULL OR r.warehouseFk = vWarehouseFk) AND (vWarehouseFk IS NULL OR r.warehouseFk = vWarehouseFk)
AND r.created >= ( AND r.created >= (
SELECT SUBTIME(util.VN_NOW(), reserveTime) SELECT util.VN_NOW() - INTERVAL TIME_TO_SEC(reserveTime) SECOND
guillermo marked this conversation as resolved Outdated

util.VN_NOW() - INTERVAL TIME_TO_SEC(reserveTime) SECOND

per estandaritzar, deuriem de guardar reserveTime en INT y canviar el SECOND per MINUTE=

util.VN_NOW() - INTERVAL TIME_TO_SEC(reserveTime) SECOND per estandaritzar, deuriem de guardar reserveTime en INT y canviar el SECOND per MINUTE=
FROM hedera.orderConfig FROM hedera.orderConfig
) )
AND NOT o.confirmed AND NOT o.confirmed
@ -89,11 +89,11 @@ BEGIN
CREATE OR REPLACE TEMPORARY TABLE tmp.itemMinacum CREATE OR REPLACE TEMPORARY TABLE tmp.itemMinacum
(INDEX(itemFk)) (INDEX(itemFk))
ENGINE = MEMORY ENGINE = MEMORY
SELECT i.itemFk, SELECT itemFk,
i.warehouseFk, warehouseFk,
i.quantity amount quantity amount
FROM tmp.itemAtp i FROM tmp.itemAtp
HAVING amount <> 0; WHERE quantity <> 0;
guillermo marked this conversation as resolved Outdated

No es necessari HAVING millor WHERE ¿?

No es necessari HAVING millor WHERE ¿?
DROP TEMPORARY TABLE DROP TEMPORARY TABLE
tmp.itemAtp, tmp.itemAtp,