refs #2687 feat: create util.procedures
gitea/salix/pipeline/pr-test There was a failure building this commit
Details
gitea/salix/pipeline/pr-test There was a failure building this commit
Details
This commit is contained in:
parent
e79bdb4456
commit
b9a624d9cd
|
@ -0,0 +1,15 @@
|
|||
DELIMITER $$
|
||||
$$
|
||||
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`tx_commit`(IN tx BOOL)
|
||||
BEGIN
|
||||
/**
|
||||
* Procedimiento para confirmar los cambios asociados a una transacción
|
||||
*
|
||||
* @param tx BOOL es true si existe transacción asociada
|
||||
*/
|
||||
IF tx THEN
|
||||
COMMIT;
|
||||
END IF;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -0,0 +1,15 @@
|
|||
DELIMITER $$
|
||||
$$
|
||||
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`tx_rollback`(tx BOOL)
|
||||
BEGIN
|
||||
/**
|
||||
* Procedimiento para deshacer los cambios asociados a una transacción
|
||||
*
|
||||
* @param tx BOOL es true si existe transacción asociada
|
||||
*/
|
||||
IF tx THEN
|
||||
ROLLBACK;
|
||||
END IF;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -0,0 +1,17 @@
|
|||
|
||||
|
||||
DELIMITER $$
|
||||
$$
|
||||
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`tx_start`(tx BOOL)
|
||||
BEGIN
|
||||
/**
|
||||
* Procedimiento para iniciar una transacción
|
||||
*
|
||||
* @param tx BOOL es true si existe transacción asociada
|
||||
*/
|
||||
IF tx THEN
|
||||
START TRANSACTION;
|
||||
END IF;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -11,11 +11,10 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`travel_cloneWithEnt
|
|||
BEGIN
|
||||
/**
|
||||
* Clona un travel junto con sus entradas y compras
|
||||
*
|
||||
* @param vTravelFk travel plantilla a clonar
|
||||
* @param vDateStart fecha del shipment del nuevo travel
|
||||
* @param vDateEnd fecha del landing del nuevo travel
|
||||
* @param vWarehouseOutFk fecha del salida del nuevo travel
|
||||
* @param vWarehouseOutFk warehouse del salida del nuevo travel
|
||||
* @param vWarehouseInFk warehouse de landing del nuevo travel
|
||||
* @param vRef referencia del nuevo travel
|
||||
* @param vAgencyModeFk del nuevo travel
|
||||
|
@ -25,6 +24,7 @@ BEGIN
|
|||
DECLARE vEvaNotes VARCHAR(255);
|
||||
DECLARE vDone BOOL;
|
||||
DECLARE vAuxEntryFk INT;
|
||||
DECLARE vTx BOOLEAN DEFAULT @@in_transaction;
|
||||
DECLARE vRsEntry CURSOR FOR
|
||||
SELECT e.id
|
||||
FROM entry e
|
||||
|
@ -35,11 +35,11 @@ BEGIN
|
|||
|
||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||
BEGIN
|
||||
ROLLBACK;
|
||||
CALL util.tx_rollback(vTx);
|
||||
RESIGNAL;
|
||||
END;
|
||||
|
||||
START TRANSACTION;
|
||||
CALL util.tx_start(vTx);
|
||||
|
||||
INSERT INTO travel (shipped, landed, warehouseInFk, warehouseOutFk, agencyModeFk, `ref`, isDelivered, isReceived, m3, cargoSupplierFk, kg,clonedFrom)
|
||||
SELECT vDateStart, vDateEnd, vWarehouseInFk, vWarehouseOutFk, vAgencyModeFk, vRef, isDelivered, isReceived, m3,cargoSupplierFk, kg,vTravelFk
|
||||
|
@ -62,7 +62,7 @@ BEGIN
|
|||
END IF;
|
||||
|
||||
CALL entry_cloneHeader(vAuxEntryFk, vNewEntryFk, vNewTravelFk);
|
||||
CALL entry_copyBuys(vAuxEntryFk, vNewEntryFk);
|
||||
CALL entry_copyBuys(vAuxEntryFk, vNewEntryFk);
|
||||
|
||||
SELECT evaNotes INTO vEvaNotes
|
||||
FROM entry
|
||||
|
@ -76,6 +76,6 @@ BEGIN
|
|||
SET @isModeInventory = FALSE;
|
||||
CLOSE vRsEntry;
|
||||
|
||||
COMMIT;
|
||||
CALL util.tx_commit(vTx);
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
label="Vehicle"
|
||||
ng-model="$ctrl.route.vehicleFk"
|
||||
url="Vehicles"
|
||||
where="{warehouseFk: $ctrl.vnConfig.warehouseFk}"
|
||||
show-field="numberPlate">
|
||||
</vn-autocomplete>
|
||||
<vn-autocomplete
|
||||
|
|
Loading…
Reference in New Issue