feat: refs #6822 return newEntry
gitea/salix/pipeline/pr-dev There was a failure building this commit
Details
gitea/salix/pipeline/pr-dev There was a failure building this commit
Details
This commit is contained in:
parent
1332aef213
commit
109770b0a3
|
@ -1,5 +1,5 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`entry_transfer`(vOriginalEntry INT)
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`entry_transfer`(vOriginalEntry INT, OUT vNewEntry INT)
|
||||
BEGIN
|
||||
/**
|
||||
* Adelanta a mañana la mercancia de una entrada a partir de lo que hay ubicado en el almacén
|
||||
|
@ -11,6 +11,16 @@ BEGIN
|
|||
DECLARE vTravelFk INT;
|
||||
DECLARE vWarehouseFk INT;
|
||||
|
||||
DECLARE CONTINUE HANDLER FOR NOT FOUND
|
||||
SET vDone = TRUE;
|
||||
|
||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||
BEGIN
|
||||
ROLLBACK;
|
||||
RESIGNAL;
|
||||
END;
|
||||
|
||||
START TRANSACTION;
|
||||
-- Clonar la entrada
|
||||
CALL entry_clone(vOriginalEntry,vNewEntryFk);
|
||||
|
||||
|
@ -100,6 +110,8 @@ BEGIN
|
|||
WHERE b.entryFk = vNewEntryFk
|
||||
AND b.quantity = 0;
|
||||
|
||||
SET vNewEntry = vNewEntryFk;
|
||||
COMMIT;
|
||||
CALL cache.visible_refresh(@c,TRUE,7);
|
||||
CALL cache.available_refresh(@c, TRUE, 7, util.VN_CURDATE());
|
||||
|
||||
|
|
|
@ -12,6 +12,10 @@ module.exports = Self => {
|
|||
http: {
|
||||
path: '/:id/transfer',
|
||||
verb: 'POST'
|
||||
},
|
||||
returns: {
|
||||
arg: 'newEntryFk',
|
||||
type: 'number'
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -28,8 +32,11 @@ module.exports = Self => {
|
|||
}
|
||||
|
||||
try {
|
||||
await Self.rawSql('CALL vn.entryTransfer(?)', [id], myOptions);
|
||||
await Self.rawSql('CALL vn.entry_transfer(?, @vNewEntry)', [id], myOptions);
|
||||
const newEntryFk = await Self.rawSql('SELECT @vNewEntry AS newEntryFk', [], myOptions);
|
||||
|
||||
if (tx) await tx.commit();
|
||||
return newEntryFk;
|
||||
} catch (e) {
|
||||
if (tx) await tx.rollback();
|
||||
throw e;
|
||||
|
|
Loading…
Reference in New Issue