diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index ea689c609..6992dd6f8 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -3180,7 +3180,7 @@ UPDATE vn.department SET workerFk = null; INSERT INTO vn.packaging - VALUES('--', 2745600.00, 100.00, 120.00, 220.00, 0.00, 1, '2001-01-01 00:00:00.000', NULL, NULL, NULL, 0.00, 16, 0.00, 0, NULL, 0.00, NULL, NULL, 0, NULL, 0, 0); + VALUES('--', 2745600.00, 100.00, 120.00, 220.00, 0.00, 1, '2001-01-01 00:00:00.000', NULL, NULL, NULL, 0.00, 16, 0.00, 0, NULL, 0.00, NULL, NULL, 0, NULL, 0, 0,0); INSERT IGNORE INTO vn.intrastat diff --git a/db/routines/vn/procedures/collection_new.sql b/db/routines/vn/procedures/collection_new.sql index 545320081..dc1280373 100644 --- a/db/routines/vn/procedures/collection_new.sql +++ b/db/routines/vn/procedures/collection_new.sql @@ -29,6 +29,8 @@ BEGIN DECLARE vLockName VARCHAR(215); DECLARE vLockTime INT DEFAULT 30; DECLARE vFreeWagonFk INT; + DECLARE vErrorNumber INT; + DECLARE vErrorMsg TEXT; DECLARE c1 CURSOR FOR SELECT ticketFk, `lines`, m3 @@ -48,6 +50,18 @@ BEGIN DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN + GET DIAGNOSTICS CONDITION 1 + vErrorNumber = MYSQL_ERRNO, + vErrorMsg = MESSAGE_TEXT; + + CALL util.debugAdd('collection_new', JSON_OBJECT( + 'errorNumber', vErrorNumber, + 'errorMsg', vErrorMsg, + 'lockName', vLockName, + 'userFk', vUserFk, + 'ticketFk', vTicketFk + )); -- Tmp + IF vLockName IS NOT NULL THEN DO RELEASE_LOCK(vLockName); END IF; @@ -180,9 +194,10 @@ BEGIN OR (NOT pb.V AND vItemPackingTypeFk = 'V') OR (pc.isPreviousPreparationRequired AND pb.previousWithoutParking) 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); + OR pb.lines > vLinesLimit + OR pb.m3 > vVolumeLimit + OR sub.maxSize > vSizeLimit + OR pb.hasPlantTray; END IF; -- Es importante que el primer ticket se coja en todos los casos @@ -354,4 +369,4 @@ BEGIN tTrain, tmp.productionBuffer; END$$ -DELIMITER ; +DELIMITER ; \ No newline at end of file diff --git a/db/routines/vn/procedures/productionControl.sql b/db/routines/vn/procedures/productionControl.sql index 5d97e3f55..ba8764c77 100644 --- a/db/routines/vn/procedures/productionControl.sql +++ b/db/routines/vn/procedures/productionControl.sql @@ -274,9 +274,8 @@ proc: BEGIN JOIN buy b ON b.id = lb.buy_id JOIN packaging p ON p.id = b.packagingFk JOIN productionConfig pc - SET hasPlantTray = TRUE - WHERE ic.code = 'plant' - AND p.`depth` >= pc.minPlantTrayLength + SET pb.hasPlantTray = TRUE + WHERE p.isPlantTray AND pb.isOwn; DROP TEMPORARY TABLE diff --git a/db/versions/11239-goldenBirch/00-firstScript.sql b/db/versions/11239-goldenBirch/00-firstScript.sql new file mode 100644 index 000000000..559982081 --- /dev/null +++ b/db/versions/11239-goldenBirch/00-firstScript.sql @@ -0,0 +1,2 @@ +-- Place your SQL code here +ALTER TABLE vn.packaging ADD IF NOT EXISTS isPlantTray BOOL DEFAULT FALSE NOT NULL COMMENT 'The container is a plant tray. Used to restrict the picking of full plant trays, to make previous picking.';