This commit is contained in:
parent
c518352bf7
commit
b97b61c7dd
|
@ -36,9 +36,9 @@ BEGIN
|
|||
INTO vWarehouseInFk,vWarehouseOutFk, vRef,vIsReceived, vAgencyModeFk
|
||||
FROM travel t
|
||||
JOIN entry e ON e.travelFk = t.id
|
||||
WHERE e.id = 1;
|
||||
WHERE e.id = vOriginalEntry;
|
||||
|
||||
SELECT t.di INTO vNewTravelFk
|
||||
SELECT t.id INTO vNewTravelFk
|
||||
FROM travel t
|
||||
JOIN entry e ON e.travelFk = t.id
|
||||
WHERE t.shipped = util.VN_CURDATE()
|
||||
|
@ -49,7 +49,7 @@ BEGIN
|
|||
AND isReceived =vIsReceived
|
||||
AND agencyModeFk = vAgencyModeFk;
|
||||
|
||||
IF NOT vNewTravelFk THEN
|
||||
IF vNewTravelFk IS NULL THEN
|
||||
INSERT INTO travel(
|
||||
shipped,
|
||||
landed,
|
||||
|
@ -113,7 +113,7 @@ BEGIN
|
|||
JOIN vn.parking p ON p.id = sh.parkingFk
|
||||
JOIN vn.sector s ON s.id = p.sectorFk
|
||||
WHERE s.warehouseFk = vWarehouseFk
|
||||
AND sh.parked = util.VN_CURDATE()
|
||||
AND sh.parked BETWEEN CURDATE() AND util.dayend(CURDATE())
|
||||
GROUP BY ish.itemFk
|
||||
),
|
||||
sales AS (
|
||||
|
@ -124,7 +124,7 @@ BEGIN
|
|||
JOIN vn.itemShelving is2 ON is2.id = iss.itemShelvingFk
|
||||
JOIN vn.shelving s2 ON s2.id = is2.shelvingFk
|
||||
WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE())
|
||||
AND s2.parked = util.VN_CURDATE()
|
||||
AND s2.parked BETWEEN CURDATE() AND util.dayend(CURDATE())
|
||||
GROUP BY s.itemFk
|
||||
)
|
||||
SELECT tmp.itemFk,
|
||||
|
@ -134,7 +134,7 @@ BEGIN
|
|||
FROM tBuy tmp
|
||||
LEFT JOIN itemShelvings iss ON tmp.itemFk = iss.itemFk
|
||||
LEFT JOIN sales s ON s.itemFk = tmp.itemFk
|
||||
WHERE visible = tmp.totalQuantity
|
||||
WHERE visible < tmp.totalQuantity
|
||||
OR iss.itemFk IS NULL;
|
||||
|
||||
UPDATE buy b
|
||||
|
|
Loading…
Reference in New Issue