Merge branch 'test' into dev
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
commit
f87ee5cb91
|
@ -33,9 +33,16 @@
|
||||||
<mrw:CodigoServicio><%= expeditionData.serviceType %></mrw:CodigoServicio>
|
<mrw:CodigoServicio><%= expeditionData.serviceType %></mrw:CodigoServicio>
|
||||||
<mrw:NumeroBultos>1</mrw:NumeroBultos>
|
<mrw:NumeroBultos>1</mrw:NumeroBultos>
|
||||||
<mrw:EntregaSabado><%= expeditionData.weekDays %></mrw:EntregaSabado>
|
<mrw:EntregaSabado><%= expeditionData.weekDays %></mrw:EntregaSabado>
|
||||||
<mrw:Peso><%= expeditionData.kg %></mrw:Peso>
|
|
||||||
<mrw:Reembolso/>
|
<mrw:Reembolso/>
|
||||||
<mrw:ImporteReembolso/>
|
<mrw:ImporteReembolso/>
|
||||||
|
<mrw:Bultos>
|
||||||
|
<mrw:BultoRequest>
|
||||||
|
<mrw:Alto><%= mrw.defaultHeight %></mrw:Alto>
|
||||||
|
<mrw:Largo><%= mrw.defaultLength %></mrw:Largo>
|
||||||
|
<mrw:Ancho><%= mrw.defaultWidth %></mrw:Ancho>
|
||||||
|
<mrw:Peso><%= mrw.defaultWeight %></mrw:Peso>
|
||||||
|
</mrw:BultoRequest>
|
||||||
|
</mrw:Bultos>
|
||||||
</mrw:DatosServicio>
|
</mrw:DatosServicio>
|
||||||
</mrw:request>
|
</mrw:request>
|
||||||
</mrw:TransmEnvio>
|
</mrw:TransmEnvio>
|
||||||
|
|
|
@ -27,6 +27,18 @@
|
||||||
},
|
},
|
||||||
"subscriberCode": {
|
"subscriberCode": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
},
|
||||||
|
"defaultHeight": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"defaultLength": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"defaultWidth": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"defaultWeight": {
|
||||||
|
"type": "number"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,28 +13,12 @@ BEGIN
|
||||||
* @param vCollectionFk Id de colección
|
* @param vCollectionFk Id de colección
|
||||||
*/
|
*/
|
||||||
DECLARE vHasTooMuchCollections BOOL;
|
DECLARE vHasTooMuchCollections BOOL;
|
||||||
DECLARE vItemPackingTypeFk VARCHAR(1);
|
|
||||||
DECLARE vWarehouseFk INT;
|
|
||||||
DECLARE vLockName VARCHAR(215);
|
|
||||||
DECLARE vLockTime INT DEFAULT 30;
|
|
||||||
|
|
||||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
|
||||||
BEGIN
|
|
||||||
IF vLockName IS NOT NULL THEN
|
|
||||||
DO RELEASE_LOCK(vLockName);
|
|
||||||
CALL util.debugAdd('releaseLock', vLockName); -- Tmp
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
RESIGNAL;
|
|
||||||
END;
|
|
||||||
|
|
||||||
-- 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
|
||||||
collection_assign_lockname
|
INTO vHasTooMuchCollections
|
||||||
INTO vHasTooMuchCollections,
|
|
||||||
vLockName
|
|
||||||
FROM productionConfig pc
|
FROM productionConfig pc
|
||||||
LEFT JOIN tCollection ON TRUE;
|
LEFT JOIN tCollection ON TRUE;
|
||||||
|
|
||||||
|
@ -44,21 +28,6 @@ BEGIN
|
||||||
CALL util.throw('Hay colecciones pendientes');
|
CALL util.throw('Hay colecciones pendientes');
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
SELECT warehouseFk, itemPackingTypeFk
|
|
||||||
INTO vWarehouseFk, vItemPackingTypeFk
|
|
||||||
FROM operator
|
|
||||||
WHERE workerFk = vUserFk;
|
|
||||||
|
|
||||||
SET vLockName = CONCAT_WS('/',
|
|
||||||
vLockName,
|
|
||||||
vWarehouseFk,
|
|
||||||
vItemPackingTypeFk
|
|
||||||
);
|
|
||||||
|
|
||||||
IF NOT GET_LOCK(vLockName, vLockTime) THEN
|
|
||||||
CALL util.throw(CONCAT('Cannot get lock: ', vLockName));
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
-- Se eliminan las colecciones sin asignar que estan obsoletas
|
-- Se eliminan las colecciones sin asignar que estan obsoletas
|
||||||
INSERT INTO ticketTracking(stateFk, ticketFk)
|
INSERT INTO ticketTracking(stateFk, ticketFk)
|
||||||
SELECT s.id, tc.ticketFk
|
SELECT s.id, tc.ticketFk
|
||||||
|
@ -66,7 +35,7 @@ BEGIN
|
||||||
JOIN ticketCollection tc ON tc.collectionFk = c.id
|
JOIN ticketCollection tc ON tc.collectionFk = c.id
|
||||||
JOIN `state` s ON s.code = 'PRINTED_AUTO'
|
JOIN `state` s ON s.code = 'PRINTED_AUTO'
|
||||||
JOIN productionConfig pc
|
JOIN productionConfig pc
|
||||||
WHERE c.workerFk IS NULL
|
WHERE c.workerFk IS NULL
|
||||||
AND TIMEDIFF(util.VN_NOW(), c.created) > pc.maxNotAssignedCollectionLifeTime;
|
AND TIMEDIFF(util.VN_NOW(), c.created) > pc.maxNotAssignedCollectionLifeTime;
|
||||||
|
|
||||||
DELETE c.*
|
DELETE c.*
|
||||||
|
@ -80,8 +49,7 @@ BEGIN
|
||||||
VALUES(vUserFk);
|
VALUES(vUserFk);
|
||||||
|
|
||||||
-- Comprueba si hay colecciones disponibles que se ajustan a su configuracion
|
-- Comprueba si hay colecciones disponibles que se ajustan a su configuracion
|
||||||
SELECT MIN(c.id)
|
SELECT MIN(c.id) INTO vCollectionFk
|
||||||
INTO vCollectionFk
|
|
||||||
FROM `collection` c
|
FROM `collection` c
|
||||||
JOIN operator o
|
JOIN operator o
|
||||||
ON (o.itemPackingTypeFk = c.itemPackingTypeFk OR c.itemPackingTypeFk IS NULL)
|
ON (o.itemPackingTypeFk = c.itemPackingTypeFk OR c.itemPackingTypeFk IS NULL)
|
||||||
|
@ -107,7 +75,5 @@ BEGIN
|
||||||
UPDATE `collection`
|
UPDATE `collection`
|
||||||
SET workerFk = vUserFk
|
SET workerFk = vUserFk
|
||||||
WHERE id = vCollectionFk;
|
WHERE id = vCollectionFk;
|
||||||
|
|
||||||
DO RELEASE_LOCK(vLockName);
|
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -6,12 +6,12 @@ BEGIN
|
||||||
*
|
*
|
||||||
* @param vDuaFk Id del dua a recalcular
|
* @param vDuaFk Id del dua a recalcular
|
||||||
*/
|
*/
|
||||||
DECLARE done BOOL DEFAULT FALSE;
|
DECLARE vDone BOOL DEFAULT FALSE;
|
||||||
DECLARE vInvoiceFk INT;
|
DECLARE vInvoiceFk INT;
|
||||||
DECLARE vASIEN BIGINT DEFAULT 0;
|
DECLARE vBookEntry INT;
|
||||||
DECLARE vCounter INT DEFAULT 0;
|
DECLARE vFiscalYear INT;
|
||||||
|
|
||||||
DECLARE rs CURSOR FOR
|
DECLARE vInvoicesIn CURSOR FOR
|
||||||
SELECT DISTINCT e.invoiceInFk
|
SELECT DISTINCT e.invoiceInFk
|
||||||
FROM entry e
|
FROM entry e
|
||||||
JOIN duaEntry de ON de.entryFk = e.id
|
JOIN duaEntry de ON de.entryFk = e.id
|
||||||
|
@ -20,9 +20,7 @@ BEGIN
|
||||||
AND de.customsValue
|
AND de.customsValue
|
||||||
AND ii.isBooked = FALSE;
|
AND ii.isBooked = FALSE;
|
||||||
|
|
||||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
|
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
||||||
|
|
||||||
OPEN rs;
|
|
||||||
|
|
||||||
UPDATE invoiceIn ii
|
UPDATE invoiceIn ii
|
||||||
JOIN entry e ON e.invoiceInFk = ii.id
|
JOIN entry e ON e.invoiceInFk = ii.id
|
||||||
|
@ -36,38 +34,36 @@ BEGIN
|
||||||
e.isConfirmed = TRUE
|
e.isConfirmed = TRUE
|
||||||
WHERE d.id = vDuaFk;
|
WHERE d.id = vDuaFk;
|
||||||
|
|
||||||
SELECT IFNULL(ASIEN,0) INTO vASIEN
|
SELECT ASIEN INTO vBookEntry FROM dua WHERE id = vDuaFk;
|
||||||
FROM dua
|
|
||||||
WHERE id = vDuaFk;
|
|
||||||
|
|
||||||
FETCH rs INTO vInvoiceFk;
|
IF vBookEntry IS NULL THEN
|
||||||
|
SELECT YEAR(IFNULL(ii.bookEntried, d.bookEntried)) INTO vFiscalYear
|
||||||
|
FROM invoiceIn ii
|
||||||
|
JOIN entry e ON e.invoiceInFk = ii.id
|
||||||
|
JOIN duaEntry de ON de.entryFk = e.id
|
||||||
|
JOIN dua d ON d.id = de.duaFk
|
||||||
|
WHERE d.id = vDuaFk
|
||||||
|
LIMIT 1;
|
||||||
|
CALL ledger_next(vFiscalYear, FALSE, vBookEntry);
|
||||||
|
END IF;
|
||||||
|
|
||||||
WHILE NOT done DO
|
OPEN vInvoicesIn;
|
||||||
|
|
||||||
CALL invoiceIn_booking(vInvoiceFk);
|
l: LOOP
|
||||||
|
SET vDone = FALSE;
|
||||||
IF vCounter > 0 OR vASIEN > 0 THEN
|
FETCH vInvoicesIn INTO vInvoiceFk;
|
||||||
|
|
||||||
UPDATE XDiario x
|
|
||||||
JOIN ledgerConfig lc ON lc.lastBookEntry = x.ASIEN
|
|
||||||
SET x.ASIEN = vASIEN;
|
|
||||||
|
|
||||||
ELSE
|
|
||||||
|
|
||||||
SELECT lastBookEntry INTO vASIEN FROM ledgerConfig;
|
|
||||||
|
|
||||||
|
IF vDone THEN
|
||||||
|
LEAVE l;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
SET vCounter = vCounter + 1;
|
CALL invoiceIn_booking(vInvoiceFk, vBookEntry);
|
||||||
|
END LOOP;
|
||||||
|
|
||||||
FETCH rs INTO vInvoiceFk;
|
CLOSE vInvoicesIn;
|
||||||
|
|
||||||
END WHILE;
|
|
||||||
|
|
||||||
CLOSE rs;
|
|
||||||
|
|
||||||
UPDATE dua
|
UPDATE dua
|
||||||
SET ASIEN = vASIEN
|
SET ASIEN = vBookEntry
|
||||||
WHERE id = vDuaFk;
|
WHERE id = vDuaFk;
|
||||||
|
|
||||||
UPDATE invoiceIn ii
|
UPDATE invoiceIn ii
|
||||||
|
|
|
@ -12,7 +12,7 @@ BEGIN
|
||||||
WHERE id = vDuaFk;
|
WHERE id = vDuaFk;
|
||||||
|
|
||||||
IF vBookNumber IS NULL OR NOT vBookNumber THEN
|
IF vBookNumber IS NULL OR NOT vBookNumber THEN
|
||||||
CALL ledger_next(YEAR(vBookDated), vBookNumber);
|
CALL ledger_next(YEAR(vBookDated), FALSE, vBookNumber);
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
-- Apunte de la aduana
|
-- Apunte de la aduana
|
||||||
|
|
|
@ -1,7 +1,17 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceIn_booking`(vSelf INT)
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceIn_booking`(
|
||||||
|
vSelf INT,
|
||||||
|
vBookNumber INT
|
||||||
|
)
|
||||||
BEGIN
|
BEGIN
|
||||||
DECLARE vBookNumber INT;
|
/**
|
||||||
|
* Genera la contabilidad para una factura y la marca como contabilizada
|
||||||
|
* Cuadra el asiento generado en si encuentra problemas derivados
|
||||||
|
* de los calculos con decimales
|
||||||
|
*
|
||||||
|
* @param vSelf Id invoiceIn
|
||||||
|
* @param vBookEntry Id de asiento, si es NULL se genera uno nuevo
|
||||||
|
*/
|
||||||
DECLARE vFiscalYear INT;
|
DECLARE vFiscalYear INT;
|
||||||
|
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tInvoiceIn
|
CREATE OR REPLACE TEMPORARY TABLE tInvoiceIn
|
||||||
|
@ -58,7 +68,10 @@ BEGIN
|
||||||
WHERE ii.id = vSelf;
|
WHERE ii.id = vSelf;
|
||||||
|
|
||||||
SELECT YEAR(bookEntried) INTO vFiscalYear FROM tInvoiceIn LIMIT 1;
|
SELECT YEAR(bookEntried) INTO vFiscalYear FROM tInvoiceIn LIMIT 1;
|
||||||
CALL ledger_next(vFiscalYear, vBookNumber);
|
|
||||||
|
IF vBookNumber IS NULL THEN
|
||||||
|
CALL ledger_next(vFiscalYear, FALSE, vBookNumber);
|
||||||
|
END IF;
|
||||||
|
|
||||||
-- Apunte del proveedor
|
-- Apunte del proveedor
|
||||||
INSERT INTO XDiario(
|
INSERT INTO XDiario(
|
||||||
|
@ -187,7 +200,7 @@ BEGIN
|
||||||
LEFT JOIN (
|
LEFT JOIN (
|
||||||
SELECT e.id
|
SELECT e.id
|
||||||
FROM tInvoiceIn tii
|
FROM tInvoiceIn tii
|
||||||
JOIN expense e ON e.id = tii.expenseFk
|
JOIN expense e ON e.id = tii.expenseFk
|
||||||
WHERE e.isWithheld
|
WHERE e.isWithheld
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
) eWithheld ON TRUE
|
) eWithheld ON TRUE
|
||||||
|
|
|
@ -61,7 +61,7 @@ BEGIN
|
||||||
WHERE io.id = vInvoice;
|
WHERE io.id = vInvoice;
|
||||||
|
|
||||||
SELECT YEAR(FECHA) INTO vFiscalYear FROM rs LIMIT 1;
|
SELECT YEAR(FECHA) INTO vFiscalYear FROM rs LIMIT 1;
|
||||||
CALL ledger_next(vFiscalYear, vBookNumber);
|
CALL ledger_next(vFiscalYear, FALSE, vBookNumber);
|
||||||
-- Linea del cliente
|
-- Linea del cliente
|
||||||
INSERT INTO XDiario(
|
INSERT INTO XDiario(
|
||||||
ASIEN,
|
ASIEN,
|
||||||
|
|
|
@ -28,7 +28,7 @@ BEGIN
|
||||||
DECLARE vIsOriginalAClient BOOL;
|
DECLARE vIsOriginalAClient BOOL;
|
||||||
DECLARE vPayMethodCompensation INT;
|
DECLARE vPayMethodCompensation INT;
|
||||||
|
|
||||||
CALL ledger_next(YEAR(vDated), vNewBookEntry);
|
CALL ledger_next(YEAR(vDated), FALSE, vNewBookEntry);
|
||||||
|
|
||||||
SELECT COUNT(id) INTO vIsOriginalAClient
|
SELECT COUNT(id) INTO vIsOriginalAClient
|
||||||
FROM client
|
FROM client
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ledger_next`(
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ledger_next`(
|
||||||
IN vFiscalYear INT,
|
IN vFiscalYear INT,
|
||||||
|
IN vIsManageTransaction BOOLEAN,
|
||||||
OUT vLastBookEntry INT
|
OUT vLastBookEntry INT
|
||||||
)
|
)
|
||||||
BEGIN
|
BEGIN
|
||||||
|
@ -22,13 +23,15 @@ BEGIN
|
||||||
CALL util.throw('Fiscal year is required');
|
CALL util.throw('Fiscal year is required');
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
SELECT @@in_transaction INTO vHasStartTransaction;
|
IF NOT vIsManageTransaction THEN
|
||||||
|
SELECT @@in_transaction INTO vHasStartTransaction;
|
||||||
|
|
||||||
IF NOT vHasStartTransaction THEN
|
IF NOT vHasStartTransaction THEN
|
||||||
START TRANSACTION;
|
START TRANSACTION;
|
||||||
ELSE
|
ELSE
|
||||||
SAVEPOINT sp;
|
SAVEPOINT sp;
|
||||||
END IF;
|
END IF;
|
||||||
|
END IF;
|
||||||
|
|
||||||
SELECT bookEntry + 1 INTO vLastBookEntry
|
SELECT bookEntry + 1 INTO vLastBookEntry
|
||||||
FROM ledgerCompany
|
FROM ledgerCompany
|
||||||
|
@ -46,10 +49,12 @@ BEGIN
|
||||||
SET bookEntry = vLastBookEntry
|
SET bookEntry = vLastBookEntry
|
||||||
WHERE fiscalYear = vFiscalYear;
|
WHERE fiscalYear = vFiscalYear;
|
||||||
|
|
||||||
IF vHasStartTransaction THEN
|
IF NOT vIsManageTransaction THEN
|
||||||
RELEASE SAVEPOINT sp;
|
IF vHasStartTransaction THEN
|
||||||
ELSE
|
RELEASE SAVEPOINT sp;
|
||||||
COMMIT;
|
ELSE
|
||||||
END IF;
|
COMMIT;
|
||||||
|
END IF;
|
||||||
|
END IF;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
|
@ -39,7 +39,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`xdiario_new`(
|
||||||
*/
|
*/
|
||||||
BEGIN
|
BEGIN
|
||||||
IF vBookNumber IS NULL THEN
|
IF vBookNumber IS NULL THEN
|
||||||
CALL ledger_next(YEAR(vDated), vBookNumber);
|
CALL ledger_next(YEAR(vDated), FALSE, vBookNumber);
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
INSERT INTO XDiario
|
INSERT INTO XDiario
|
||||||
|
|
|
@ -9,13 +9,12 @@ BEGIN
|
||||||
DECLARE vIsCash BOOLEAN;
|
DECLARE vIsCash BOOLEAN;
|
||||||
DECLARE vIsSupplierActive BOOLEAN;
|
DECLARE vIsSupplierActive BOOLEAN;
|
||||||
|
|
||||||
-- PAK 10/02/15 No se asientan los pagos directamente, salvo en el caso de las cajas de CASH
|
|
||||||
SELECT (at2.code = 'cash') INTO vIsCash
|
SELECT (at2.code = 'cash') INTO vIsCash
|
||||||
FROM accounting a
|
FROM accounting a
|
||||||
JOIN accountingType at2 ON at2.id = a.accountingTypeFk
|
JOIN accountingType at2 ON at2.id = a.accountingTypeFk
|
||||||
WHERE a.id = NEW.bankFk;
|
WHERE a.id = NEW.bankFk;
|
||||||
|
|
||||||
IF vIsCash THEN
|
IF vIsCash THEN
|
||||||
SELECT account INTO vBankAccount
|
SELECT account INTO vBankAccount
|
||||||
FROM accounting
|
FROM accounting
|
||||||
WHERE id = NEW.bankFk;
|
WHERE id = NEW.bankFk;
|
||||||
|
@ -24,7 +23,7 @@ BEGIN
|
||||||
FROM supplier
|
FROM supplier
|
||||||
WHERE id = NEW.supplierFk;
|
WHERE id = NEW.supplierFk;
|
||||||
|
|
||||||
CALL ledger_next(YEAR(NEW.received), NEW.companyFk, vNewBookEntry);
|
CALL ledger_next(YEAR(NEW.received), TRUE, vNewBookEntry);
|
||||||
|
|
||||||
INSERT INTO XDiario (
|
INSERT INTO XDiario (
|
||||||
ASIEN,
|
ASIEN,
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
-- Place your SQL code here
|
||||||
|
ALTER TABLE vn.mrwConfig ADD IF NOT EXISTS defaultHeight INT UNSIGNED NULL COMMENT 'default height in centimeters';
|
||||||
|
ALTER TABLE vn.mrwConfig ADD IF NOT EXISTS defaultLength INT UNSIGNED NULL COMMENT 'default length in centimeters';
|
||||||
|
ALTER TABLE vn.mrwConfig ADD IF NOT EXISTS defaultWidth INT UNSIGNED NULL COMMENT 'default width in centimeters';
|
||||||
|
ALTER TABLE vn.mrwConfig ADD IF NOT EXISTS defaultWeight INT UNSIGNED NULL COMMENT 'default weight in centimeters';
|
|
@ -32,7 +32,7 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await Self.rawSql(`CALL vn.invoiceIn_booking(?)`, [id], myOptions);
|
await Self.rawSql(`CALL vn.invoiceIn_booking(?, NULL)`, [id], myOptions);
|
||||||
if (tx) await tx.commit();
|
if (tx) await tx.commit();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (tx) await tx.rollback();
|
if (tx) await tx.rollback();
|
||||||
|
|
Loading…
Reference in New Issue