Merge branch '6346-FixWagonModule' of https://gitea.verdnatura.es/verdnatura/salix into 6346-FixWagonModule

This commit is contained in:
Jon Elias 2024-08-21 13:25:29 +02:00
commit ec4b8b9e4f
9 changed files with 102 additions and 57 deletions

View File

@ -37,7 +37,6 @@ module.exports = Self => {
}); });
const xmlString = response.data; const xmlString = response.data;
console.log('xmlString: ', xmlString);
const parser = new DOMParser(); const parser = new DOMParser();
const xmlDoc = parser.parseFromString(xmlString, 'text/xml'); const xmlDoc = parser.parseFromString(xmlString, 'text/xml');
const result = xmlDoc.getElementsByTagName('Mensaje')[0].textContent; const result = xmlDoc.getElementsByTagName('Mensaje')[0].textContent;

View File

@ -0,0 +1,12 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `vn`.`travel_setDelivered`
ON SCHEDULE EVERY 1 DAY
STARTS '2024-07-12 00:10:00.000'
ON COMPLETION PRESERVE
ENABLE
DO BEGIN
UPDATE travel t
SET t.isDelivered = TRUE
WHERE t.shipped < util.VN_CURDATE();
END$$
DELIMITER ;

View File

@ -12,6 +12,7 @@ BEGIN
DECLARE vInvoiceFk INT; DECLARE vInvoiceFk INT;
DECLARE vBookEntry INT; DECLARE vBookEntry INT;
DECLARE vFiscalYear INT; DECLARE vFiscalYear INT;
DECLARE vIncorrectInvoiceInDueDay INT;
DECLARE vInvoicesIn CURSOR FOR DECLARE vInvoicesIn CURSOR FOR
SELECT DISTINCT e.invoiceInFk SELECT DISTINCT e.invoiceInFk
@ -24,6 +25,19 @@ BEGIN
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
SELECT GROUP_CONCAT(ii.id) INTO vIncorrectInvoiceInDueDay
FROM invoiceInDueDay iidd
JOIN invoiceIn ii ON iidd.invoiceInFk = ii.id
JOIN `entry` e ON e.invoiceInFk = ii.id
JOIN duaEntry de ON de.entryFk = e.id
JOIN invoiceInConfig iic
WHERE de.duaFk = vDuaFk
AND iidd.dueDated <= util.VN_CURDATE() + INTERVAL iic.dueDateMarginDays DAY;
IF vIncorrectInvoiceInDueDay THEN
CALL util.throw(CONCAT('Incorrect due date, invoice: ', vIncorrectInvoiceInDueDay));
END IF;
UPDATE invoiceIn ii UPDATE invoiceIn ii
JOIN entry e ON e.invoiceInFk = ii.id JOIN entry e ON e.invoiceInFk = ii.id
JOIN duaEntry de ON de.entryFk = e.id JOIN duaEntry de ON de.entryFk = e.id

View File

@ -1,5 +1,7 @@
DELIMITER $$ DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceInDueDay_calculate`(vInvoiceInFk INT) CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceInDueDay_calculate`(
vInvoiceInFk INT
)
BEGIN BEGIN
/** /**
* Calcula los vctos. de una factura recibida * Calcula los vctos. de una factura recibida
@ -56,12 +58,13 @@ BEGIN
COUNT(DISTINCT(pdd.detail)) cont, COUNT(DISTINCT(pdd.detail)) cont,
s.payDay, s.payDay,
ii.issued, ii.issued,
DATE(ii.created) + INTERVAL 2 DAY created DATE(ii.created) + INTERVAL iic.dueDateMarginDays DAY created
FROM invoiceIn ii FROM invoiceIn ii
JOIN invoiceInTax iit ON iit.invoiceInFk = ii.id JOIN invoiceInTax iit ON iit.invoiceInFk = ii.id
LEFT JOIN sage.TiposIva ti ON ti.CodigoIva= iit.taxTypeSageFk LEFT JOIN sage.TiposIva ti ON ti.CodigoIva= iit.taxTypeSageFk
JOIN supplier s ON s.id = ii.supplierFk JOIN supplier s ON s.id = ii.supplierFk
JOIN payDemDetail pdd ON pdd.id = s.payDemFk JOIN payDemDetail pdd ON pdd.id = s.payDemFk
JOIN invoiceInConfig iic
WHERE ii.id = vInvoiceInFk WHERE ii.id = vInvoiceInFk
GROUP BY ii.id GROUP BY ii.id
)sub )sub

View File

@ -75,13 +75,6 @@ proc: BEGIN
) sub ) sub
GROUP BY itemFk; GROUP BY itemFk;
UPDATE tmp.itemInventory ai
JOIN tItemInventoryCalc iic ON iic.itemFk = ai.id
SET ai.inventory = iic.quantity,
ai.visible = iic.quantity,
ai.avalaible = iic.quantity,
ai.sd = iic.quantity;
-- Cálculo del visible -- Cálculo del visible
CALL cache.visible_refresh(vCalcFk, FALSE, vWarehouseFk); CALL cache.visible_refresh(vCalcFk, FALSE, vWarehouseFk);
@ -93,8 +86,12 @@ proc: BEGIN
WHERE calc_id = vCalcFk; WHERE calc_id = vCalcFk;
UPDATE tmp.itemInventory it UPDATE tmp.itemInventory it
JOIN tItemInventoryCalc iic ON iic.itemFk = it.id
JOIN tItemVisibleCalc ivc ON ivc.item_id = it.id JOIN tItemVisibleCalc ivc ON ivc.item_id = it.id
SET it.visible = it.visible + ivc.visible; SET it.inventory = iic.quantity,
it.visible = ivc.visible,
it.avalaible = iic.quantity,
it.sd = iic.quantity;
-- Calculo del disponible -- Calculo del disponible
CREATE OR REPLACE TEMPORARY TABLE tmp.itemCalc CREATE OR REPLACE TEMPORARY TABLE tmp.itemCalc
@ -142,8 +139,9 @@ proc: BEGIN
CALL item_getAtp(vDate); CALL item_getAtp(vDate);
CALL travel_upcomingArrivals(vWarehouseFk, vDate); CALL travel_upcomingArrivals(vWarehouseFk, vDate);
UPDATE tmp.itemInventory ai CREATE OR REPLACE TEMPORARY TABLE tItemAvailableCalc
JOIN ( (PRIMARY KEY (itemFk))
ENGINE = MEMORY
SELECT it.itemFk, SELECT it.itemFk,
SUM(it.quantity) quantity, SUM(it.quantity) quantity,
im.quantity minQuantity im.quantity minQuantity
@ -155,18 +153,21 @@ proc: BEGIN
WHERE it.dated < IF(vMaxDays < 0 AND t.landing IS NOT NULL, WHERE it.dated < IF(vMaxDays < 0 AND t.landing IS NOT NULL,
t.landing, t.landing,
vDateToTomorrow) vDateToTomorrow)
GROUP BY it.itemFk GROUP BY it.itemFk;
) sub ON sub.itemFk = ai.id
SET ai.avalaible = IF(sub.minQuantity > 0, UPDATE tmp.itemInventory it
ai.avalaible, JOIN tItemAvailableCalc iac ON iac.itemFk = it.id
ai.avalaible + sub.minQuantity), SET it.avalaible = IF(iac.minQuantity > 0,
ai.sd = ai.inventory + sub.quantity; it.avalaible,
it.avalaible + iac.minQuantity),
it.sd = it.inventory + iac.quantity;
DROP TEMPORARY TABLE DROP TEMPORARY TABLE
tmp.itemTravel, tmp.itemTravel,
tmp.itemCalc, tmp.itemCalc,
tmp.itemAtp, tmp.itemAtp,
tItemInventoryCalc, tItemInventoryCalc,
tItemVisibleCalc; tItemVisibleCalc,
tItemAvailableCalc;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -174,8 +174,9 @@ proc: BEGIN
WHERE NOT `lines`; WHERE NOT `lines`;
-- Lineas por linea de encajado -- Lineas por linea de encajado
UPDATE tmp.productionBuffer pb CREATE OR REPLACE TEMPORARY TABLE tItemPackingType
JOIN ( (PRIMARY KEY(ticketFk))
ENGINE = MEMORY
SELECT ticketFk, SELECT ticketFk,
SUM(sub.H) H, SUM(sub.H) H,
SUM(sub.V) V, SUM(sub.V) V,
@ -190,11 +191,13 @@ proc: BEGIN
JOIN item i ON i.id = s.itemFk JOIN item i ON i.id = s.itemFk
GROUP BY t.ticketFk, i.itemPackingTypeFk GROUP BY t.ticketFk, i.itemPackingTypeFk
) sub ) sub
GROUP BY ticketFk GROUP BY ticketFk;
) sub2 ON sub2.ticketFk = pb.ticketFk
SET pb.H = sub2.H, UPDATE tmp.productionBuffer pb
pb.V = sub2.V, JOIN tItemPackingType ti ON ti.ticketFk = pb.ticketFk
pb.N = sub2.N; SET pb.H = ti.H,
pb.V = ti.V,
pb.N = ti.N;
-- Colecciones segun tipo de encajado -- Colecciones segun tipo de encajado
UPDATE tmp.productionBuffer pb UPDATE tmp.productionBuffer pb
@ -273,6 +276,7 @@ proc: BEGIN
tmp.risk, tmp.risk,
tmp.ticket_problems, tmp.ticket_problems,
tmp.ticketWithPrevia, tmp.ticketWithPrevia,
tItemShelvingStock; tItemShelvingStock,
tItemPackingType;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -1,7 +1,7 @@
DELIMITER $$ DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_splitItemPackingType`( CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_splitItemPackingType`(
vSelf INT, vSelf INT,
vItemPackingTypeFk VARCHAR(1) vOriginalItemPackingTypeFk VARCHAR(1)
) )
BEGIN BEGIN
/** /**
@ -9,7 +9,7 @@ BEGIN
* Respeta el id inicial para el tipo propuesto. * Respeta el id inicial para el tipo propuesto.
* *
* @param vSelf Id ticket * @param vSelf Id ticket
* @param vItemPackingTypeFk Tipo para el que se reserva el número de ticket original * @param vOriginalItemPackingTypeFk Tipo para el que se reserva el número de ticket original
* @return table tmp.ticketIPT(ticketFk, itemPackingTypeFk) * @return table tmp.ticketIPT(ticketFk, itemPackingTypeFk)
*/ */
DECLARE vItemPackingTypeFk VARCHAR(1) DEFAULT 'H'; DECLARE vItemPackingTypeFk VARCHAR(1) DEFAULT 'H';
@ -23,7 +23,7 @@ BEGIN
SELECT itemPackingTypeFk SELECT itemPackingTypeFk
FROM tSaleGroup FROM tSaleGroup
WHERE itemPackingTypeFk IS NOT NULL WHERE itemPackingTypeFk IS NOT NULL
ORDER BY (itemPackingTypeFk = vItemPackingTypeFk) DESC; ORDER BY (itemPackingTypeFk = vOriginalItemPackingTypeFk) DESC;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;

View File

@ -0,0 +1,2 @@
ALTER TABLE vn.invoiceInConfig
ADD dueDateMarginDays INT UNSIGNED DEFAULT 2 NULL;

View File

@ -4,7 +4,17 @@ import getMainRoute from 'core/lib/get-main-route';
config.$inject = ['$stateProvider', '$urlRouterProvider']; config.$inject = ['$stateProvider', '$urlRouterProvider'];
function config($stateProvider, $urlRouterProvider) { function config($stateProvider, $urlRouterProvider) {
$urlRouterProvider $urlRouterProvider
.otherwise('/'); .otherwise(async($injector, {$location}) => {
const prefix = '#!';
if (!$location.$$path) return window.location.href = `/${prefix}/`;
const url = $location.$$absUrl
.replace('5000', '9000')
.replace('salix', 'lilium')
.replace(prefix, '#')
.replace('client', 'customer');
window.location.href = url;
});
$stateProvider $stateProvider
.state('layout', { .state('layout', {