Merge branch 'dev' into 7296-expeditionTruck
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Robert Ferrús 2024-04-30 10:04:40 +00:00
commit 5ea57ce728
9 changed files with 53 additions and 13 deletions

View File

@ -0,0 +1,13 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`connection_kill`(
vConnectionId BIGINT
)
BEGIN
/**
* Kill a connection
*
* @param vConnectionId
*/
KILL vConnectionId;
END$$
DELIMITER ;

View File

@ -30,10 +30,9 @@ BEGIN
-- Si hay colecciones sin terminar, sale del proceso
CALL collection_get(vUserFk);
SELECT (pc.maxNotReadyCollections - COUNT(*)) <= 0
INTO vHasTooMuchCollections
FROM tCollection
JOIN productionConfig pc;
SELECT (pc.maxNotReadyCollections - COUNT(*)) <= 0 INTO vHasTooMuchCollections
FROM productionConfig pc
LEFT JOIN tCollection ON TRUE;
DROP TEMPORARY TABLE tCollection;
@ -47,7 +46,7 @@ BEGIN
WHERE workerFk = vUserFk;
SET vLockName = CONCAT_WS('/',
'collection_assign',
vLockName,
vWarehouseFk,
vItemPackingTypeFk
);

View File

@ -63,7 +63,8 @@ BEGIN
o.numberOfWagons,
o.trainFk,
o.linesLimit,
o.volumeLimit
o.volumeLimit,
pc.collection_new_lockname
INTO vMaxTickets,
vHasUniqueCollectionTime,
vWorkerCode,
@ -73,14 +74,15 @@ BEGIN
vWagons,
vTrainFk,
vLinesLimit,
vVolumeLimit
vVolumeLimit,
vLockName
FROM productionConfig pc
JOIN worker w ON w.id = vUserFk
JOIN state st ON st.`code` = 'ON_PREPARATION'
JOIN operator o ON o.workerFk = vUserFk;
SET vLockName = CONCAT_WS('/',
'collection_new',
vLockName,
vWarehouseFk,
vItemPackingTypeFk
);

View File

@ -79,6 +79,10 @@ BEGIN
ORDER BY (vQuantity % `grouping`) ASC
LIMIT 1;
IF vNewPrice IS NULL THEN
CALL util.throw('price retrieval failed');
END IF;
IF vNewPrice > vOldPrice THEN
SET vFinalPrice = vOldPrice;
SET vOption = 'substitution';
@ -90,7 +94,8 @@ BEGIN
START TRANSACTION;
UPDATE sale
SET quantity = quantity - vQuantity
SET originalQuantity = quantity - vQuantity,
quantity = quantity - vQuantity
WHERE id = vSaleFk;
INSERT INTO vn.sale(ticketFk,
@ -100,7 +105,8 @@ BEGIN
price)
SELECT vTicketFk,
vNewItemFk,
CEIL(vQuantity / vRoundQuantity) * vRoundQuantity, CONCAT('+ ', i.name),
CEIL(vQuantity / vRoundQuantity) * vRoundQuantity,
CONCAT('+ ', i.name),
vFinalPrice
FROM vn.item i
WHERE id = vNewItemFk;

View File

@ -63,7 +63,7 @@ BEGIN
INSERT INTO ticketPackaging (ticketFk, packagingFk, quantity)
(SELECT vCurTicketFk, p.id, COUNT(*)
FROM expedition e
JOIN packaging p ON p.itemFk = e.freightItemFk
JOIN packaging p ON p.id = e.packagingFk
WHERE e.ticketFk = vCurTicketFk AND p.isPackageReturnable
AND vWithPackage
GROUP BY p.itemFk);

View File

@ -0,0 +1,5 @@
-- Place your SQL code here
ALTER TABLE vn.productionConfig ADD collectionNewLockname varchar(100)
DEFAULT 'collection_new' NOT NULL COMMENT 'Lockname value for proc vn.collection_new';
ALTER TABLE vn.productionConfig ADD collectionAssignLockname varchar(100)
DEFAULT 'collection_assign' NULL COMMENT 'Lockname value for proc vn.collection_new';

View File

@ -0,0 +1,3 @@
-- Place your SQL code here
ALTER TABLE vn.productionConfig ADD collection_new_lockname varchar(100) DEFAULT 'collection_new' NOT NULL COMMENT 'Lockname value for proc vn.collection_new';
ALTER TABLE vn.productionConfig ADD collection_assign_lockname varchar(100) DEFAULT 'collection_assign' NULL COMMENT 'Lockname value for proc vn.collection_new';

View File

@ -0,0 +1,13 @@
ALTER TABLE vn.productionConfig
DROP COLUMN IF EXISTS collectionNewLockname,
DROP COLUMN IF EXISTS collectionAssignLockname;
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`connection_kill`()
BEGIN
END$$
DELIMITER ;
GRANT EXECUTE ON PROCEDURE util.connection_kill TO 'developer';

View File

@ -49,8 +49,7 @@ module.exports = Self => {
JOIN vn.agencyMode am ON am.id = r.agencyModeFk
JOIN vn.agency ag ON ag.id = am.agencyFk
LEFT JOIN vn.userConfig uc ON uc.userFk = account.myUser_getId()
WHERE (r.created = util.VN_CURDATE() OR r.created = util.yesterday())
AND t.routeFk = ?
WHERE t.routeFk = ?
GROUP BY t.addressFk, e.itemPackingTypeFk
) sub
GROUP BY addressFk