feat(available): refs #8408 available refreshing now includes time
gitea/salix/pipeline/pr-dev There was a failure building this commit Details

Refs: #8408
This commit is contained in:
Pako Natek 2025-01-29 12:03:55 +01:00
parent b8f9dc7ad7
commit 0de9c3c172
5 changed files with 17 additions and 13 deletions

View File

@ -3,7 +3,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `cache`.`available_refres
OUT `vCalc` INT,
`vRefresh` INT,
`vWarehouse` INT,
`vDated` DATE
`vAvailabled` DATETIME
)
proc: BEGIN
DECLARE vStartDate DATE;
@ -12,6 +12,7 @@ proc: BEGIN
DECLARE vInventoryDate DATE;
DECLARE vLifeScope DATE;
DECLARE vWarehouseFkInventory INT;
DECLARE vDated DATE;
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
@ -19,13 +20,17 @@ proc: BEGIN
RESIGNAL;
END;
IF vDated < util.VN_CURDATE() THEN
IF vAvailabled < util.VN_CURDATE() THEN
LEAVE proc;
END IF;
SET vDated = DATE(vAvailabled);
SET vAvailabled = vDated + INTERVAL HOUR(vAvailabled) HOUR;
CALL vn.item_getStock(vWarehouse, vDated, NULL);
SET vParams = CONCAT_WS('/', vWarehouse, vDated);
SET vParams = CONCAT_WS('/', vWarehouse, vAvailabled);
CALL cache_calc_start (vCalc, vRefresh, 'available', vParams);
IF !vRefresh THEN
@ -87,11 +92,10 @@ proc: BEGIN
SELECT i.itemFk, i.landed, i.quantity
FROM vn.itemEntryIn i
JOIN itemRange ir ON ir.itemFk = i.itemFk
LEFT JOIN edi.warehouseFloramondo wf ON wf.entryFk = i.entryFk
WHERE i.landed >= vStartDate
AND IFNULL(i.availabled, i.landed) <= vAvailabled
AND (ir.ended IS NULL OR i.landed <= ir.ended)
AND i.warehouseInFk = vWarehouse
AND ISNULL(wf.entryFk)
UNION ALL
SELECT i.itemFk, i.shipped, i.quantity
FROM vn.itemEntryOut i

View File

@ -15,8 +15,6 @@ BEGIN
*
* @return tmp.itemList(itemFk, stock, visible, available)
*/
DECLARE vIsLogifloraDay BOOL DEFAULT vn.isLogifloraDay(vDated, vWarehouseFk);
SET vDated = TIMESTAMP(vDated, '00:00:00');
CREATE OR REPLACE TEMPORARY TABLE tmp.itemList
@ -36,14 +34,11 @@ BEGIN
UNION ALL
SELECT iei.itemFk, iei.quantity
FROM itemEntryIn iei
LEFT JOIN edi.warehouseFloramondo wf ON wf.entryFk = iei.entryFk
JOIN item i ON i.id = iei.itemFk
WHERE iei.landed >= util.VN_CURDATE()
AND iei.landed < vDated
AND iei.warehouseInFk = vWarehouseFk
AND (vItemFk IS NULL OR iei.itemFk = vItemFk)
AND (wf.entryFk IS NULL OR vIsLogifloraDay)
AND NOT (iei.landed > util.VN_CURDATE() AND i.isFloramondo)
UNION ALL
SELECT ieo.itemFk, ieo.quantity
FROM itemEntryOut ieo
@ -52,7 +47,6 @@ BEGIN
AND ieo.shipped < vDated
AND ieo.warehouseOutFk = vWarehouseFk
AND (vItemFk IS NULL OR ieo.itemFk = vItemFk)
AND NOT (ieo.shipped > util.VN_CURDATE() AND i.isFloramondo)
) sub
GROUP BY itemFk
HAVING stock;

View File

@ -7,7 +7,8 @@ AS SELECT `t`.`warehouseInFk` AS `warehouseInFk`,
`b`.`quantity` AS `quantity`,
`t`.`isReceived` AS `isReceived`,
`t`.`isRaid` AS `isVirtualStock`,
`e`.`id` AS `entryFk`
`e`.`id` AS `entryFk`,
`t`.`availabled`
FROM (
(
`vn`.`buy` `b`

View File

@ -1,3 +1,5 @@
USE vn;
DELETE ai from
`vn`.`agencyIncoming` ai
LEFT JOIN `vn`.`agencyMode` am ON
@ -7,6 +9,6 @@ DELETE ai from
ALTER TABLE `vn`.`agencyIncoming`
ADD CONSTRAINT `fk_agencyIncoming_agencyMode`
FOREIGN KEY (`agencyModeFk`)
REFERENCES `agencyMode`(`id`)
REFERENCES `vn`.`agencyMode`(`id`)
ON DELETE CASCADE
ON UPDATE CASCADE;

View File

@ -0,0 +1,3 @@
-- Place your SQL code here
ALTER TABLE vn.travel ADD IF NOT EXISTS availabled DATETIME NULL
COMMENT 'Indicates the moment in time when the goods become available for picking';