Merge branch 'master' into 7268-hotFix_getChanges_datestring
gitea/salix/pipeline/pr-master This commit looks good Details

This commit is contained in:
Alex Moreno 2024-05-02 06:55:57 +00:00
commit fa982df610
10 changed files with 47 additions and 12 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 -- Si hay colecciones sin terminar, sale del proceso
CALL collection_get(vUserFk); CALL collection_get(vUserFk);
SELECT (pc.maxNotReadyCollections - COUNT(*)) <= 0 SELECT (pc.maxNotReadyCollections - COUNT(*)) <= 0 INTO vHasTooMuchCollections
INTO vHasTooMuchCollections FROM productionConfig pc
FROM tCollection LEFT JOIN tCollection ON TRUE;
JOIN productionConfig pc;
DROP TEMPORARY TABLE tCollection; DROP TEMPORARY TABLE tCollection;

View File

@ -81,6 +81,10 @@ BEGIN
ORDER BY (vQuantity % `grouping`) ASC ORDER BY (vQuantity % `grouping`) ASC
LIMIT 1; LIMIT 1;
IF vNewPrice IS NULL THEN
CALL util.throw('price retrieval failed');
END IF;
IF vNewPrice > vOldPrice THEN IF vNewPrice > vOldPrice THEN
SET vFinalPrice = vOldPrice; SET vFinalPrice = vOldPrice;
SET vOption = 'substitution'; SET vOption = 'substitution';
@ -103,7 +107,8 @@ BEGIN
price) price)
SELECT vTicketFk, SELECT vTicketFk,
vNewItemFk, vNewItemFk,
CEIL(vQuantity / vRoundQuantity) * vRoundQuantity, CONCAT('+ ', i.name), CEIL(vQuantity / vRoundQuantity) * vRoundQuantity,
CONCAT('+ ', i.name),
vFinalPrice vFinalPrice
FROM vn.item i FROM vn.item i
WHERE id = vNewItemFk; WHERE id = vNewItemFk;

View File

@ -63,7 +63,7 @@ BEGIN
INSERT INTO ticketPackaging (ticketFk, packagingFk, quantity) INSERT INTO ticketPackaging (ticketFk, packagingFk, quantity)
(SELECT vCurTicketFk, p.id, COUNT(*) (SELECT vCurTicketFk, p.id, COUNT(*)
FROM expedition e 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 WHERE e.ticketFk = vCurTicketFk AND p.isPackageReturnable
AND vWithPackage AND vWithPackage
GROUP BY p.itemFk); GROUP BY p.itemFk);

View File

@ -4,7 +4,5 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`ticketPackaging_befor
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
SET NEW.editorFk = account.myUser_getId(); SET NEW.editorFk = account.myUser_getId();
SET NEW.workerFk = account.myUser_getId();
END$$ END$$
DELIMITER ; DELIMITER ;

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,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

@ -27,8 +27,11 @@ module.exports = Self => {
const where = filter.where; const where = filter.where;
const query = 'CALL vn.item_getBalance(?, ?, ?)'; const query = 'CALL vn.item_getBalance(?, ?, ?)';
if (where?.date) {
where.date = new Date(where.date);
where.date.setHours(0, 0, 0, 0);
}
const [diary] = await Self.rawSql(query, [where.itemFk, where.warehouseFk, where.date], myOptions); const [diary] = await Self.rawSql(query, [where.itemFk, where.warehouseFk, where.date], myOptions);
for (const entry of diary) for (const entry of diary)
if (entry.clientType === 'loses') entry.highlighted = true; if (entry.clientType === 'loses') entry.highlighted = true;

View File

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

View File

@ -30,7 +30,7 @@ module.exports = Self => {
}); });
Self.addSaleByCode = async(ctx, barcode, quantity, ticketFk, warehouseFk, options) => { Self.addSaleByCode = async(ctx, barcode, quantity, ticketFk, warehouseFk, options) => {
const myOptions = {}; const myOptions = {userId: ctx.req.accessToken.userId};
let tx; let tx;
if (typeof options == 'object') if (typeof options == 'object')