feat: previas con sitema de reservas refs #6861 #2176
|
@ -87,8 +87,9 @@ BEGIN
|
||||||
IF vSaleGroupFk THEN
|
IF vSaleGroupFk THEN
|
||||||
INSERT INTO saleGroupDetail
|
INSERT INTO saleGroupDetail
|
||||||
SET saleFk = vSaleFk,
|
SET saleFk = vSaleFk,
|
||||||
saleGroupFk = vSaleGroupFk,
|
saleGroupFk = vSaleGroupFk;
|
||||||
COMMIT;
|
COMMIT;
|
||||||
END IF;
|
END IF;
|
||||||
|
END IF ;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -52,6 +52,7 @@ BEGIN
|
||||||
FROM tmp.sale ts
|
FROM tmp.sale ts
|
||||||
JOIN sale s ON s.id = ts.saleFk
|
JOIN sale s ON s.id = ts.saleFk
|
||||||
JOIN itemShelving ish ON ish.itemFk = s.itemFk
|
JOIN itemShelving ish ON ish.itemFk = s.itemFk
|
||||||
|
LEFT JOIN itemShelvingSale iss ON iss.saleFk = s.id
|
||||||
LEFT JOIN (
|
LEFT JOIN (
|
||||||
SELECT itemShelvingFk, SUM(quantity) reservedQuantity
|
SELECT itemShelvingFk, SUM(quantity) reservedQuantity
|
||||||
FROM itemShelvingSale
|
FROM itemShelvingSale
|
||||||
|
@ -64,6 +65,7 @@ BEGIN
|
||||||
JOIN productionConfig pc
|
JOIN productionConfig pc
|
||||||
WHERE w.id = vWarehouseFk
|
WHERE w.id = vWarehouseFk
|
||||||
AND NOT sc.isHideForPickers
|
AND NOT sc.isHideForPickers
|
||||||
|
AND iss.id IS NULL
|
||||||
ORDER BY
|
ORDER BY
|
||||||
s.id,
|
s.id,
|
||||||
p.pickingOrder >= vLastPickingOrder,
|
p.pickingOrder >= vLastPickingOrder,
|
||||||
|
|
|
@ -8,6 +8,8 @@ BEGIN
|
||||||
*
|
*
|
||||||
* @param vSectorCollectionFk Identificador de sectorCollection
|
* @param vSectorCollectionFk Identificador de sectorCollection
|
||||||
*/
|
*/
|
||||||
|
DECLARE vHasSales BOOL;
|
||||||
|
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tmp.sale
|
CREATE OR REPLACE TEMPORARY TABLE tmp.sale
|
||||||
(INDEX(saleFk))
|
(INDEX(saleFk))
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
|
@ -18,9 +20,18 @@ BEGIN
|
||||||
JOIN saleTracking str ON str.saleFk = s.id
|
JOIN saleTracking str ON str.saleFk = s.id
|
||||||
JOIN `state` st ON st.id = str.stateFk
|
JOIN `state` st ON st.id = str.stateFk
|
||||||
AND st.code = 'PREVIOUS_PREPARATION'
|
AND st.code = 'PREVIOUS_PREPARATION'
|
||||||
|
LEFT JOIN itemShelvingSale iss ON iss.saleFk = s.id
|
||||||
WHERE sc.sectorCollectionFk = vSectorCollectionFk
|
WHERE sc.sectorCollectionFk = vSectorCollectionFk
|
||||||
AND str.workerFk = account.myUser_getId();
|
AND str.workerFk = account.myUser_getId()
|
||||||
|
AND iss.id IS NULL;
|
||||||
|
|
||||||
|
SELECT COUNT(*)INTO vHasSales
|
||||||
|
FROM tmp.sale;
|
||||||
|
|
||||||
|
IF vHasSales THEN
|
||||||
CALL itemShelvingSale_reserve();
|
CALL itemShelvingSale_reserve();
|
||||||
|
ELSE
|
||||||
|
CALL util.throw ('There are not sales to reserve');
|
||||||
|
END IF;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sectorCollection_getPartial`()
|
||||||
carlosap marked this conversation as resolved
Outdated
|
|||||||
|
BEGIN
|
||||||
|
/**
|
||||||
|
* Devuelve las colecciones del sector que corresponden al usuario conectado, y que estan incompletas
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
SELECT DISTINCT sc.id collectionFk, sc.created
|
||||||
|
FROM vn.sectorCollection sc
|
||||||
|
LEFT JOIN vn.sectorCollectionSaleGroup scsg ON scsg.sectorCollectionFk = sc.id
|
||||||
|
LEFT JOIN vn.saleGroupDetail sgd ON sgd.saleGroupFk = scsg.saleGroupFk
|
||||||
|
LEFT JOIN vn.sale sl ON sl.id = sgd.saleFk
|
||||||
|
LEFT JOIN itemShelvingSale iss ON iss.saleFk = sl.id
|
||||||
|
WHERE sc.userFk = account.myUser_getId()
|
||||||
|
AND (ISNULL(scsg.sectorCollectionFk)
|
||||||
|
OR (NOT iss.isPicked))
|
||||||
|
AND sc.created > util.VN_CURDATE() - INTERVAL 1 DAY;
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -0,0 +1,28 @@
|
||||||
|
CREATE DEFINER=`root`@`localhost` FUNCTION vn.sectorCollection_hasSalesReserved(vSelf INT) RETURNS tinyint(1)
|
||||||
|
DETERMINISTIC
|
||||||
|
BEGIN
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Devuelve si sectorCollection tiene reservas
|
||||||
|
* @param vSelf Id de sectorCollection
|
||||||
|
*
|
||||||
|
* returns BOOLEAN
|
||||||
|
*/
|
||||||
|
|
||||||
|
DECLARE vHasSalesReserved BOOLEAN;
|
||||||
|
|
||||||
|
|
||||||
|
SELECT DISTINCT COUNT(*)>0 INTO vHasSalesReserved
|
||||||
jgallego marked this conversation as resolved
Outdated
jgallego
commented
sols un bot sols un bot
|
|||||||
|
FROM vn.sectorCollection sc
|
||||||
jgallego marked this conversation as resolved
Outdated
jgallego
commented
`>` 0 redundant
|
|||||||
|
JOIN vn.sectorCollectionSaleGroup scsg ON sc.id = scsg.sectorCollectionFk
|
||||||
jgallego marked this conversation as resolved
Outdated
jgallego
commented
sense vn. sense vn.
|
|||||||
|
JOIN vn.saleGroup sg ON sg.id = scsg.saleGroupFk
|
||||||
|
JOIN vn.saleGroupDetail sgd ON sgd.saleGroupFk = sg.id
|
||||||
|
JOIN vn.sale s ON s.id = sgd.saleFk
|
||||||
|
JOIN vn.itemShelvingSale iss ON iss.saleFk = s.id
|
||||||
|
JOIN vn.saleTracking st ON st.saleFk = s.id
|
||||||
|
WHERE sc.id = vSelf;
|
||||||
|
|
||||||
|
RETURN vHasSalesReserved;
|
||||||
|
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -3,6 +3,8 @@ ALTER TABLE vn.itemShelvingSale DROP COLUMN IF EXISTS isPicked;
|
||||||
ALTER TABLE vn.itemShelvingSale
|
ALTER TABLE vn.itemShelvingSale
|
||||||
ADD isPicked TINYINT(1) DEFAULT FALSE NOT NULL;
|
ADD isPicked TINYINT(1) DEFAULT FALSE NOT NULL;
|
||||||
|
|
||||||
|
UPDATE vn.itemShelvingSale SET isPicked = TRUE;
|
||||||
|
|
||||||
ALTER TABLE vn.productionConfig DROP COLUMN IF EXISTS orderMode;
|
ALTER TABLE vn.productionConfig DROP COLUMN IF EXISTS orderMode;
|
||||||
|
|
||||||
ALTER TABLE vn.productionConfig
|
ALTER TABLE vn.productionConfig
|
||||||
|
|
Loading…
Reference in New Issue
sectorCollection_getMyPartial