fixes: refs #7760 collection problems #2888

Merged
carlosap merged 7 commits from 7760-Refactor-collection_assign into dev 2024-08-28 15:27:16 +00:00
Member
No description provided.
carlosap added 1 commit 2024-08-27 08:48:00 +00:00
gitea/salix/pipeline/pr-dev This commit looks good Details
b317c8c462
fixes: refs #7760 collection problems
carlosap requested review from jgallego 2024-08-27 08:48:11 +00:00
carlosap requested review from guillermo 2024-08-27 08:48:21 +00:00
guillermo requested changes 2024-08-27 09:02:38 +00:00
Dismissed
@ -0,0 +2,4 @@
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`collection_mergeSales`(vCollectionFk INT)
BEGIN
DECLARE vDone BOOL;
-- Fetch variables
Member

??

??
carlosap marked this conversation as resolved
@ -0,0 +5,4 @@
-- Fetch variables
DECLARE vTicketFk INT;
DECLARE cCur CURSOR FOR
Member
El nombre del cursor no es correcto: https://wiki.verdnatura.es/index.php/Convenciones_SQL#Cursores
carlosap marked this conversation as resolved
@ -0,0 +7,4 @@
DECLARE cCur CURSOR FOR
SELECT ticketFk
FROM vn.ticketCollection
Member

Aquí sobre el vn.

Aquí sobre el `vn.`
carlosap marked this conversation as resolved
@ -0,0 +23,4 @@
LEAVE l;
END IF;
CALL vn.ticket_mergeSales(vTicketFk);
Member

Aquí sobre el vn.

Aquí sobre el `vn.`
carlosap marked this conversation as resolved
@ -196,4 +157,1 @@
OR LENGTH(pb.problem) > 0
OR (pb.lines > vLinesLimit AND vLinesLimit IS NOT NULL)
OR (pb.m3 > vVolumeLimit AND vVolumeLimit IS NOT NULL)
OR ((sub.maxSize > vSizeLimit OR sub.maxSize IS NOT NULL) AND vSizeLimit IS NOT NULL);
Member

Has quitado mis cambios

Has quitado mis cambios
carlosap marked this conversation as resolved
@ -10,3 +13,3 @@
DECLARE vWagons INT;
DECLARE vTrainFk INT;
DECLARE vLinesLimit INT;
DECLARE vLinesLimit INT DEFAULT NULL;
Member

Por defecto ya es NULL

Por defecto ya es NULL
carlosap marked this conversation as resolved
@ -13,2 +15,3 @@
DECLARE vLinesLimit INT DEFAULT NULL;
DECLARE vTicketLines INT;
DECLARE vVolumeLimit DECIMAL;
DECLARE vVolumeLimit DECIMAL DEFAULT NULL;
Member

Por defecto ya es NULL

Por defecto ya es NULL
carlosap marked this conversation as resolved
jgallego requested changes 2024-08-27 10:26:45 +00:00
Dismissed
@ -15,4 +18,3 @@
DECLARE vTicketVolume DECIMAL;
DECLARE vSizeLimit INT;
DECLARE vMaxTickets INT;
DECLARE vStateFk VARCHAR(45);
Owner

ja que estem renombra a vStateCode perque no es el id lo que es guarda sino el code, es confus

ja que estem renombra a vStateCode perque no es el id lo que es guarda sino el code, es confus
carlosap marked this conversation as resolved
@ -99,1 +52,3 @@
FETCH vSaleGroup INTO vItemPackingTypeFk;
l: LOOP
SET vDone = FALSE;
FETCH vItemPackingTypes INTO vitemPackingTypeFk;
Owner

vItemPackingTypeFk

vItemPackingTypeFk
carlosap marked this conversation as resolved
carlosap added 1 commit 2024-08-27 11:31:11 +00:00
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
3ac2c18da5
fixes: refs #7760 collection problems
carlosap added 1 commit 2024-08-27 11:36:09 +00:00
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
44072de928
fixes: refs #7760 collection problems
carlosap added 1 commit 2024-08-27 11:43:24 +00:00
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
58f8903b53
fixes: refs #7760 collection problems
carlosap added 1 commit 2024-08-27 11:47:50 +00:00
gitea/salix/pipeline/pr-dev This commit looks good Details
6090e8ceee
fixes: refs #7760 collection problems
carlosap requested review from guillermo 2024-08-27 11:49:28 +00:00
carlosap requested review from jgallego 2024-08-27 11:49:30 +00:00
jgallego approved these changes 2024-08-27 12:13:25 +00:00
guillermo requested changes 2024-08-27 12:39:53 +00:00
Dismissed
@ -164,0 +124,4 @@
-- Si hay tickets asignados, nos centramos exclusivamente en esos tickets
-- y los sacamos independientemente de problemas o tamaños
SELECT EXISTS (
Member

Ací per que no fas aço?

	SELECT TRUE INTO vHasAssignedTickets
			FROM tmp.productionBuffer pb
				JOIN state s ON s.id = pb.state
			WHERE s.code = 'PICKER_DESIGNED'
				AND pb.workerCode = vWorkerCode;
				AND pb.workerCode = vWorkerCode
			LIMIT 1
Ací per que no fas aço? ``` SELECT TRUE INTO vHasAssignedTickets FROM tmp.productionBuffer pb JOIN state s ON s.id = pb.state WHERE s.code = 'PICKER_DESIGNED' AND pb.workerCode = vWorkerCode; AND pb.workerCode = vWorkerCode LIMIT 1 ```
Author
Member
Per optimitzar: https://wiki.verdnatura.es/index.php/Convenciones_SQL#:~:text=SELECT%20EXISTS%20(SELECT%20TRUE%20FROM%20vn.ticket%20WHERE%20false%20LIMIT%201)%3B
Member

Pues en el cas de gastar EXISTS el LIMIT te sobra, ja que nomes trova un registre per a la execució, hi ha que canviar-ho en la wiki tame.

https://stackoverflow.com/questions/34759173/any-point-in-using-limit-in-exists-query

Pues en el cas de gastar EXISTS el LIMIT te sobra, ja que nomes trova un registre per a la execució, hi ha que canviar-ho en la wiki tame. https://stackoverflow.com/questions/34759173/any-point-in-using-limit-in-exists-query
Author
Member

El LIMIT és per a que quan trove la primera coincidencia no continue, crec que optimitza el resultat, quan més registres tinga la taula més li costarà

El LIMIT és per a que quan trove la primera coincidencia no continue, crec que optimitza el resultat, quan més registres tinga la taula més li costarà
carlosap marked this conversation as resolved
@ -194,71 +166,64 @@ BEGIN
OR (NOT pb.V AND vItemPackingTypeFk = 'V')
OR (pc.isPreviousPreparationRequired AND pb.previousWithoutParking)
OR LENGTH(pb.problem) > 0
Member

LENGTH(pb.problem)

`LENGTH(pb.problem)`
carlosap marked this conversation as resolved
@ -289,0 +246,4 @@
SELECT wagon INTO vFreeWagonFk
FROM tTrain
GROUP BY wagon
HAVING SUM(IFNULL(ticketFk, 0)) = 0
Member

Me podries explicar esta part? Per que sumes els ticketFk??
Ho he vist tame baix

Me podries explicar esta part? Per que sumes els ticketFk?? Ho he vist tame baix
Author
Member

El que es vol és agafar el primer vagó lliure (sense tickets asignats) del tren

El que es vol és agafar el primer vagó lliure (sense tickets asignats) del tren
guillermo marked this conversation as resolved
@ -347,3 +307,3 @@
JOIN (
JOIN(
SELECT COUNT(*) saleTotalCount,
SUM(s.isPicked <> 0) salePickedCount
Member

SUM(s.isPicked)

`SUM(s.isPicked)`
Author
Member

Crec que està fet per el 1 -1 com a valors de TRUE, és posible que algún formulari en access modifiquen el dato, el SUM el faría mal.

Crec que està fet per el 1 -1 com a valors de TRUE, és posible que algún formulari en access modifiquen el dato, el SUM el faría mal.
Member

Es que ho he comprovat, i si es -1 es TRUE, per lo tant fa el que volem

Es que ho he comprovat, i si es -1 es TRUE, per lo tant fa el que volem
Author
Member

No és el mateix, estic segur, quan pugues heu mirem

No és el mateix, estic segur, quan pugues heu mirem
carlosap marked this conversation as resolved
@ -27,3 +27,3 @@
END IF;
CALL vn.sales_merge(vTicketFk);
CALL vn.ticket_mergeSales(vTicketFk);
Member

No poner vn.

No poner `vn.`
carlosap marked this conversation as resolved
@ -0,0 +26,4 @@
WHERE s.ticketFk = vSelf
AND it.isMergeable
GROUP BY s.itemFk, s.price, s.discount
HAVING COUNT(*) > 1;
Member

HAVING COUNT(*);

`HAVING COUNT(*);`
Author
Member

Se vol que siga més de 1 registre, si no te més d'un registre agrupat, el procès no farà merge de res.
Si el canviarem es crearía la taula per al registres en COUNT(*) = 1 i ixos hi ha que descartar-los

Se vol que siga més de 1 registre, si no te més d'un registre agrupat, el procès no farà merge de res. Si el canviarem es crearía la taula per al registres en COUNT(*) = 1 i ixos hi ha que descartar-los
Member

Val sí, tens tota la raó

Val sí, tens tota la raó
guillermo marked this conversation as resolved
@ -74,3 +36,1 @@
WHERE itemPackingTypeFk IS NOT NULL;
CREATE OR REPLACE TEMPORARY TABLE tmp.ticketIPT(
CREATE OR REPLACE TEMPORARY TABLE tmp.salesToMove (
Member

Como es una tabla que no sale del procedimiento, reenombrar a tSalesToMove

Como es una tabla que no sale del procedimiento, reenombrar a `tSalesToMove`
carlosap marked this conversation as resolved
carlosap added 1 commit 2024-08-27 16:36:11 +00:00
gitea/salix/pipeline/pr-dev This commit looks good Details
16fd69904b
fixes: refs #7760 collection problems
carlosap requested review from guillermo 2024-08-27 16:38:20 +00:00
carlosap added 1 commit 2024-08-28 10:33:09 +00:00
gitea/salix/pipeline/pr-dev This commit looks good Details
484bb48d04
fix: refs #7760 collection problems
guillermo approved these changes 2024-08-28 11:44:04 +00:00
carlosap merged commit 1a47040e75 into dev 2024-08-28 15:27:16 +00:00
carlosap deleted branch 7760-Refactor-collection_assign 2024-08-28 15:27:16 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: verdnatura/salix#2888
No description provided.