7658-devToTest_2428 #2663
|
@ -85,10 +85,11 @@ BEGIN
|
|||
CALL util.throw("No hay disponibilidad para el artículo seleccionado");
|
||||
ELSE
|
||||
IF vSaleGroupFk THEN
|
||||
INSERT INTO saleGroupDetail
|
||||
SET saleFk = vSaleFk,
|
||||
saleGroupFk = vSaleGroupFk,
|
||||
COMMIT;
|
||||
END IF;
|
||||
INSERT INTO saleGroupDetail
|
||||
SET saleFk = vSaleFk,
|
||||
saleGroupFk = vSaleGroupFk;
|
||||
COMMIT;
|
||||
END IF;
|
||||
END IF ;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -52,6 +52,7 @@ BEGIN
|
|||
FROM tmp.sale ts
|
||||
JOIN sale s ON s.id = ts.saleFk
|
||||
JOIN itemShelving ish ON ish.itemFk = s.itemFk
|
||||
LEFT JOIN itemShelvingSale iss ON iss.saleFk = s.id
|
||||
LEFT JOIN (
|
||||
SELECT itemShelvingFk, SUM(quantity) reservedQuantity
|
||||
FROM itemShelvingSale
|
||||
|
@ -64,6 +65,7 @@ BEGIN
|
|||
JOIN productionConfig pc
|
||||
WHERE w.id = vWarehouseFk
|
||||
AND NOT sc.isHideForPickers
|
||||
AND iss.id IS NULL
|
||||
ORDER BY
|
||||
s.id,
|
||||
p.pickingOrder >= vLastPickingOrder,
|
||||
|
|
|
@ -8,6 +8,8 @@ BEGIN
|
|||
*
|
||||
* @param vSectorCollectionFk Identificador de sectorCollection
|
||||
*/
|
||||
DECLARE vHasSales BOOL;
|
||||
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.sale
|
||||
(INDEX(saleFk))
|
||||
ENGINE = MEMORY
|
||||
|
@ -18,9 +20,18 @@ BEGIN
|
|||
JOIN saleTracking str ON str.saleFk = s.id
|
||||
JOIN `state` st ON st.id = str.stateFk
|
||||
AND st.code = 'PREVIOUS_PREPARATION'
|
||||
LEFT JOIN itemShelvingSale iss ON iss.saleFk = s.id
|
||||
WHERE sc.sectorCollectionFk = vSectorCollectionFk
|
||||
AND str.workerFk = account.myUser_getId();
|
||||
AND str.workerFk = account.myUser_getId()
|
||||
AND iss.id IS NULL;
|
||||
|
||||
CALL itemShelvingSale_reserve();
|
||||
SELECT COUNT(*)INTO vHasSales
|
||||
FROM tmp.sale;
|
||||
|
||||
IF vHasSales THEN
|
||||
CALL itemShelvingSale_reserve();
|
||||
ELSE
|
||||
CALL util.throw ('There are not sales to reserve');
|
||||
END IF;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sectorCollection_getPartial`()
|
||||
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
|
||||
FROM vn.sectorCollection sc
|
||||
JOIN vn.sectorCollectionSaleGroup scsg ON sc.id = scsg.sectorCollectionFk
|
||||
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
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue