8032-devToTest_2440 #3009

Merged
alexm merged 262 commits from 8032-devToTest_2440 into test 2024-09-24 09:34:49 +00:00
216 changed files with 1303 additions and 5056 deletions
Showing only changes of commit dc5691fce7 - Show all commits

View File

@ -0,0 +1,29 @@
module.exports = Self => {
Self.remoteMethodCtx('killSession', {
description: 'Kill session',
accepts: [{
arg: 'userId',
type: 'integer',
description: 'The user id',
required: true,
}, {
arg: 'created',
type: 'date',
description: 'The created time',
required: true,
}],
accessType: 'WRITE',
http: {
path: `/killSession`,
verb: 'POST'
}
});
Self.killSession = async function(ctx, userId, created) {
await Self.app.models.VnUser.userSecurity(ctx, ctx.req.accessToken.userId);
const tokens = await Self.app.models.AccessToken.find({where: {userId, created}});
if (!tokens?.length) return;
for (const token of tokens)
await Self.app.models.AccessToken.deleteById(token.id);
};
};

View File

@ -175,6 +175,9 @@
"ViaexpressConfig": {
"dataSource": "vn"
},
"VnToken": {
"dataSource": "vn"
},
"VnUser": {
"dataSource": "vn"
},

5
back/models/vn-token.js Normal file
View File

@ -0,0 +1,5 @@
const vnModel = require('vn-loopback/common/models/vn-model');
module.exports = function(Self) {
vnModel(Self);
require('../methods/vn-token/killSession')(Self);
};

22
back/models/vn-token.json Normal file
View File

@ -0,0 +1,22 @@
{
"name": "VnToken",
"base": "AccessToken",
"options": {
"mysql": {
"table": "salix.AccessToken"
}
},
"properties": {
"created": {
"type": "date"
}
},
"relations": {
"user": {
"type": "belongsTo",
"model": "VnUser",
"foreignKey": "userId"
}
},
"hidden": ["id"]
}

View File

@ -25,6 +25,9 @@
"isManaged": {
"type": "boolean"
},
"isDestiny": {
"type": "boolean"
},
"countryFk": {
"type": "number"
}

View File

@ -9,7 +9,7 @@
},
"vn": {
"view": {
"expeditionPallet_Print": "ced2b84a114fcb99fce05f0c34f4fc03f3fa387bef92621be1bc306608a84345"
"expeditionPallet_Print": "99f75145ac2e7b612a6d71e74b6e55f194a465780fd9875a15eb01e6596b447e"
}
}
}

View File

@ -108,6 +108,7 @@ INSERT INTO `vn`.`worker`(`id`,`code`, `firstName`, `lastName`, `bossFk`)
UPDATE `vn`.`worker` SET bossFk = NULL WHERE id = 20;
UPDATE `vn`.`worker` SET bossFk = 20 WHERE id = 1 OR id = 9;
UPDATE `vn`.`worker` SET bossFk = 19 WHERE id = 18;
UPDATE `vn`.`worker` SET bossFk = 50 WHERE id = 49;
DELETE FROM `vn`.`worker` WHERE firstName ='customer';
@ -2487,7 +2488,7 @@ INSERT INTO `vn`.`clientDms`(`clientFk`, `dmsFk`)
(1104, 2),
(1104, 3);
INSERT INTO `vn`.`workerDocument`(`id`, `worker`, `document`,`isReadableByWorker`)
INSERT INTO `vn`.`workerDms`(`id`, `workerFk`, `dmsFk`,`isReadableByWorker`)
VALUES
(1, 1106, 4, TRUE),
(2, 1107, 3, FALSE);
@ -3056,9 +3057,6 @@ INSERT INTO `vn`.`workerTimeControlMail` (`id`, `workerFk`, `year`, `week`, `sta
(3, 9, 2000, 51, 'CONFIRMED', util.VN_NOW(), 1, NULL),
(4, 9, 2001, 1, 'SENDED', util.VN_NOW(), 1, NULL);
INSERT INTO `vn`.`wagonConfig` (`id`, `width`, `height`, `maxWagonHeight`, `minHeightBetweenTrays`, `maxTrays`)
VALUES
(1, 1350, 1900, 200, 50, 6);
INSERT INTO `vn`.`wagonTypeColor` (`id`, `name`, `rgb`)
VALUES
@ -3067,15 +3065,19 @@ INSERT INTO `vn`.`wagonTypeColor` (`id`, `name`, `rgb`)
(3, 'green', '#00ff00'),
(4, 'blue', '#0000ff');
INSERT INTO `vn`.`wagonConfig` (`id`, `width`, `height`, `maxWagonHeight`, `minHeightBetweenTrays`, `maxTrays`, `defaultTrayColorFk`)
VALUES
(1, 1350, 1900, 200, 50, 6, 1);
INSERT INTO `vn`.`wagonType` (`id`, `name`, `divisible`)
VALUES
(1, 'Wagon Type #1', 1);
INSERT INTO `vn`.`wagonTypeTray` (`id`, `typeFk`, `height`, `colorFk`)
INSERT INTO `vn`.`wagonTypeTray` (`id`, `wagonTypeFk`, `height`, `wagonTypeColorFk`)
VALUES
(1, 1, 100, 1),
(1, 1, 0, 1),
(2, 1, 50, 2),
(3, 1, 0, 3);
(3, 1, 100, 3);
INSERT INTO `salix`.`accessTokenConfig` (`id`, `renewPeriod`, `courtesyTime`, `renewInterval`)
VALUES
@ -3967,3 +3969,7 @@ VALUES
(4, 'Referencia Transferencias', 'trnRef'),
(5, 'Referencia Nominas', 'payRef'),
(6, 'ABA', 'aba');
INSERT IGNORE INTO ormConfig
SET id =1,
selectLimit = 1000;

View File

@ -1,5 +1,10 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `cache`.`available_refresh`(OUT `vCalc` INT, IN `vRefresh` INT, IN `vWarehouse` INT, IN `vDated` DATE)
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `cache`.`available_refresh`(
OUT `vCalc` INT,
`vRefresh` INT,
`vWarehouse` INT,
`vDated` DATE
)
proc: BEGIN
DECLARE vStartDate DATE;
DECLARE vReserveDate DATETIME;

View File

@ -0,0 +1,31 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `cache`.`available_updateItem`(
`vItem` INT,
`vWarehouse` INT,
`vDated` DATE,
`vQuantity` INT
)
BEGIN
/**
* Immediately deduct/add an amount from the available cache (if exists).
*
* @param vItem The item id
* @param vWarehouse The warehouse id
* @param vDated Available cache date
* @param vQuantity The amount to be deducted from the cache
*/
DECLARE vCalc INT;
SELECT id INTO vCalc
FROM cache_calc
WHERE cacheName = 'available'
AND params = CONCAT_WS('/', vWarehouse, vDated);
IF vCalc IS NOT NULL THEN
UPDATE available
SET available = available - vQuantity
WHERE calc_id = vCalc
AND item_id = vItem;
END IF;
END$$
DELIMITER ;

View File

@ -4,7 +4,7 @@ proc: BEGIN
/**
* Crea o actualiza la cache con la última compra y fecha de cada
* artículo hasta ayer. Para obtener la última compra hasta una fecha
* determinada utilizar el procedimiento vn.buyUltimate().
* determinada utilizar el procedimiento vn.buy_getUltimate().
*
* @param vRefresh %TRUE para forzar el recálculo de la cache
*/

View File

@ -1,8 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `edi`.`floramondo`
ON SCHEDULE EVERY 6 MINUTE
STARTS '2022-01-28 09:52:45.000'
ON COMPLETION NOT PRESERVE
DISABLE
DO CALL edi.floramondo_offerRefresh()$$
DELIMITER ;

View File

@ -1,522 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `edi`.`floramondo_offerRefresh`()
proc: BEGIN
DECLARE vLanded DATETIME;
DECLARE vDone INT DEFAULT FALSE;
DECLARE vFreeId INT;
DECLARE vSupplyResponseFk INT;
DECLARE vLastInserted DATETIME;
DECLARE vIsAuctionDay BOOLEAN;
DECLARE vMaxNewItems INT DEFAULT 10000;
DECLARE vStartingTime DATETIME;
DECLARE vAalsmeerMarketPlaceID VARCHAR(13) DEFAULT '8713783439043';
DECLARE vDayRange INT;
DECLARE cur1 CURSOR FOR
SELECT id
FROM edi.item_free;
DECLARE cur2 CURSOR FOR
SELECT srId
FROM itemToInsert;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
DECLARE EXIT HANDLER FOR SQLSTATE '45000'
BEGIN
ROLLBACK;
RESIGNAL;
END;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
BEGIN
DO RELEASE_LOCK('edi.floramondo_offerRefresh');
SET @isTriggerDisabled = FALSE;
RESIGNAL;
END;
IF 'test' = (SELECT environment FROM util.config) THEN
LEAVE proc;
END IF;
IF !GET_LOCK('edi.floramondo_offerRefresh', 0) THEN
LEAVE proc;
END IF;
SELECT dayRange INTO vDayRange
FROM offerRefreshConfig;
IF vDayRange IS NULL THEN
CALL util.throw("Variable vDayRange not declared");
END IF;
SET vStartingTime = util.VN_NOW();
TRUNCATE edi.offerList;
INSERT INTO edi.offerList(supplier, total)
SELECT v.name, COUNT(DISTINCT sr.ID) total
FROM edi.supplyResponse sr
JOIN edi.VMPSettings v ON v.VMPID = sr.vmpID
WHERE sr.NumberOfUnits > 0
AND sr.EmbalageCode != 999
GROUP BY sr.vmpID;
UPDATE edi.offerList o
JOIN (SELECT v.name, COUNT(*) total
FROM edi.supplyOffer sr
JOIN edi.VMPSettings v ON v.VMPID = sr.vmpID
GROUP BY sr.vmpID) sub ON o.supplier = sub.name
SET o.`filter` = sub.total;
-- Elimina de la lista de items libres aquellos que ya existen
DELETE itf.*
FROM edi.item_free itf
JOIN vn.item i ON i.id = itf.id;
CREATE OR REPLACE TEMPORARY TABLE tmp
(INDEX (`Item_ArticleCode`))
ENGINE = MEMORY
SELECT t.*
FROM (
SELECT *
FROM edi.supplyOffer
ORDER BY (MarketPlaceID = vAalsmeerMarketPlaceID) DESC,
NumberOfUnits DESC LIMIT 10000000000000000000) t
GROUP BY t.srId;
CREATE OR REPLACE TEMPORARY TABLE edi.offer (INDEX (`srID`), INDEX (`EmbalageCode`),
INDEX (`ef1`), INDEX (`ef2`), INDEX (`ef3`), INDEX (`ef4`),INDEX (`ef5`), INDEX (`ef6`),
INDEX (`s1Value`), INDEX (`s2Value`), INDEX (`s3Value`), INDEX (`s4Value`),INDEX (`s5Value`), INDEX (`s6Value`))
ENGINE = MEMORY
SELECT so.*,
ev1.type_description s1Value,
ev2.type_description s2Value,
ev3.type_description s3Value,
ev4.type_description s4Value,
ev5.type_description s5Value,
ev6.type_description s6Value,
eif1.feature ef1,
eif2.feature ef2,
eif3.feature ef3,
eif4.feature ef4,
eif5.feature ef5,
eif6.feature ef6
FROM tmp so
LEFT JOIN edi.item_feature eif1 ON eif1.item_id = so.Item_ArticleCode
AND eif1.presentation_order = 1
AND eif1.expiry_date IS NULL
LEFT JOIN edi.item_feature eif2 ON eif2.item_id = so.Item_ArticleCode
AND eif2.presentation_order = 2
AND eif2.expiry_date IS NULL
LEFT JOIN edi.item_feature eif3 ON eif3.item_id = so.Item_ArticleCode
AND eif3.presentation_order = 3
AND eif3.expiry_date IS NULL
LEFT JOIN edi.item_feature eif4 ON eif4.item_id = so.Item_ArticleCode
AND eif4.presentation_order = 4
AND eif4.expiry_date IS NULL
LEFT JOIN edi.item_feature eif5 ON eif5.item_id = so.Item_ArticleCode
AND eif5.presentation_order = 5
AND eif5.expiry_date IS NULL
LEFT JOIN edi.item_feature eif6 ON eif6.item_id = so.Item_ArticleCode
AND eif6.presentation_order = 6
AND eif6.expiry_date IS NULL
LEFT JOIN edi.`value` ev1 ON ev1.type_id = eif1.feature
AND so.s1 = ev1.type_value
LEFT JOIN edi.`value` ev2 ON ev2.type_id = eif2.feature
AND so.s2 = ev2.type_value
LEFT JOIN edi.`value` ev3 ON ev3.type_id = eif3.feature
AND so.s3 = ev3.type_value
LEFT JOIN edi.`value` ev4 ON ev4.type_id = eif4.feature
AND so.s4 = ev4.type_value
LEFT JOIN edi.`value` ev5 ON ev5.type_id = eif5.feature
AND so.s5 = ev5.type_value
LEFT JOIN edi.`value` ev6 ON ev6.type_id = eif6.feature
AND so.s6 = ev6.type_value
ORDER BY Price;
DROP TEMPORARY TABLE tmp;
DELETE o
FROM edi.offer o
LEFT JOIN vn.tag t1 ON t1.ediTypeFk = o.ef1 AND t1.overwrite = 'size'
LEFT JOIN vn.tag t2 ON t2.ediTypeFk = o.ef2 AND t2.overwrite = 'size'
LEFT JOIN vn.tag t3 ON t3.ediTypeFk = o.ef3 AND t3.overwrite = 'size'
LEFT JOIN vn.tag t4 ON t4.ediTypeFk = o.ef4 AND t4.overwrite = 'size'
LEFT JOIN vn.tag t5 ON t5.ediTypeFk = o.ef5 AND t5.overwrite = 'size'
LEFT JOIN vn.tag t6 ON t6.ediTypeFk = o.ef6 AND t6.overwrite = 'size'
JOIN vn.floramondoConfig fc ON TRUE
WHERE (t1.id IS NOT NULL AND CONVERT(s1Value, UNSIGNED) > fc.itemMaxSize)
OR (t2.id IS NOT NULL AND CONVERT(s2Value, UNSIGNED) > fc.itemMaxSize)
OR (t3.id IS NOT NULL AND CONVERT(s3Value, UNSIGNED) > fc.itemMaxSize)
OR (t4.id IS NOT NULL AND CONVERT(s4Value, UNSIGNED) > fc.itemMaxSize)
OR (t5.id IS NOT NULL AND CONVERT(s5Value, UNSIGNED) > fc.itemMaxSize)
OR (t6.id IS NOT NULL AND CONVERT(s6Value, UNSIGNED) > fc.itemMaxSize);
START TRANSACTION;
-- Actualizamos el campo supplyResponseFk para aquellos articulos que ya estan creados y reutilizamos
UPDATE IGNORE edi.offer o
JOIN vn.item i
ON i.name = o.product_name
AND i.subname <=> o.company_name
AND i.value5 <=> o.s1Value
AND i.value6 <=> o.s2Value
AND i.value7 <=> o.s3Value
AND i.value8 <=> o.s4Value
AND i.value9 <=> o.s5Value
AND i.value10 <=> o.s6Value
AND i.NumberOfItemsPerCask <=> o.NumberOfItemsPerCask
AND i.EmbalageCode <=> o.EmbalageCode
AND i.quality <=> o.Quality
JOIN vn.itemType it ON it.id = i.typeFk
LEFT JOIN vn.sale s ON s.itemFk = i.id
LEFT JOIN vn.ticket t ON t.id = s.ticketFk
AND t.shipped > (util.VN_CURDATE() - INTERVAL 1 WEEK)
LEFT JOIN edi.supplyResponse sr ON sr.ID = i.supplyResponseFk
LEFT JOIN edi.deliveryInformation di ON di.supplyResponseID = sr.ID
LEFT JOIN edi.putOrder po ON po.supplyResponseID = i.supplyResponseFk
AND po.OrderTradeLineDateTime > (util.VN_CURDATE() - INTERVAL 1 WEEK)
SET i.supplyResponseFk = o.srID
WHERE (sr.ID IS NULL
OR sr.NumberOfUnits = 0
OR di.LatestOrderDateTime < util.VN_NOW()
OR di.ID IS NULL)
AND it.isInventory
AND t.id IS NULL
AND po.id IS NULL;
CREATE OR REPLACE TEMPORARY TABLE itemToInsert
ENGINE = MEMORY
SELECT o.*, CAST(NULL AS DECIMAL(6,0)) itemFk
FROM edi.offer o
LEFT JOIN vn.item i ON i.supplyResponseFk = o.srId
WHERE i.id IS NULL
LIMIT vMaxNewItems;
-- Reciclado de nº de item
OPEN cur1;
OPEN cur2;
read_loop: LOOP
FETCH cur2 INTO vSupplyResponseFk;
FETCH cur1 INTO vFreeId;
IF vDone THEN
LEAVE read_loop;
END IF;
UPDATE itemToInsert
SET itemFk = vFreeId
WHERE srId = vSupplyResponseFk;
END LOOP;
CLOSE cur1;
CLOSE cur2;
-- Insertamos todos los items en Articles de la oferta
INSERT INTO vn.item(id,
`name`,
longName,
subName,
expenseFk,
typeFk,
intrastatFk,
originFk,
supplyResponseFk,
numberOfItemsPerCask,
embalageCode,
quality,
isFloramondo)
SELECT iti.itemFk,
iti.product_name,
iti.product_name,
iti.company_name,
iti.expenseFk,
iti.itemTypeFk,
iti.intrastatFk,
iti.originFk,
iti.`srId`,
iti.NumberOfItemsPerCask,
iti.EmbalageCode,
iti.Quality,
TRUE
FROM itemToInsert iti;
-- Inserta la foto de los articulos nuevos (prioridad alta)
INSERT IGNORE INTO vn.itemImageQueue(itemFk, url)
SELECT i.id, PictureReference
FROM itemToInsert ii
JOIN vn.item i ON i.supplyResponseFk = ii.srId
WHERE PictureReference IS NOT NULL
AND i.image IS NULL;
INSERT INTO edi.`log`(tableName, fieldName,fieldValue)
SELECT 'itemImageQueue','NumImagenesPtes', COUNT(*)
FROM vn.itemImageQueue
WHERE attempts = 0;
-- Inserta si se añadiesen tags nuevos
INSERT IGNORE INTO vn.tag (name, ediTypeFk)
SELECT description, type_id FROM edi.type;
-- Desabilita el trigger para recalcular los tags al final
SET @isTriggerDisabled = TRUE;
-- Inserta los tags sólo en los articulos nuevos
INSERT INTO vn.itemTag(itemFk, tagFk, value, priority)
SELECT i.id, t.id , ii.product_name, 1
FROM itemToInsert ii
JOIN vn.tag t ON t.`name` = 'Producto'
JOIN vn.item i ON i.supplyResponseFk = ii.`srId`
WHERE NOT ii.product_name IS NULL;
INSERT INTO vn.itemTag(itemFk, tagFk, value, priority)
SELECT i.id, t.id , ii.Quality, 3
FROM itemToInsert ii
JOIN vn.tag t ON t.`name` = 'Calidad'
JOIN vn.item i ON i.supplyResponseFk = ii.`srId`
WHERE NOT ii.Quality IS NULL;
INSERT INTO vn.itemTag(itemFk, tagFk, value, priority)
SELECT i.id, t.id , ii.company_name, 4
FROM itemToInsert ii
JOIN vn.tag t ON t.`name` = 'Productor'
JOIN vn.item i ON i.supplyResponseFk = ii.`srId`
WHERE NOT ii.company_name IS NULL;
INSERT INTO vn.itemTag(itemFk, tagFk, value, priority)
SELECT i.id, t.id , s1Value, 5
FROM itemToInsert ii
JOIN vn.tag t ON t.ediTypeFk = ii.ef1
JOIN vn.item i ON i.supplyResponseFk = ii.`srId`
WHERE NOT s1Value IS NULL;
INSERT INTO vn.itemTag(itemFk, tagFk, value, priority)
SELECT i.id, t.id , s2Value, 6
FROM itemToInsert ii
JOIN vn.tag t ON t.ediTypeFk = ii.ef2
JOIN vn.item i ON i.supplyResponseFk = ii.`srId`
WHERE NOT s2Value IS NULL;
INSERT INTO vn.itemTag(itemFk, tagFk, value, priority)
SELECT i.id, t.id , s3Value, 7
FROM itemToInsert ii
JOIN vn.tag t ON t.ediTypeFk = ii.ef3
JOIN vn.item i ON i.supplyResponseFk = ii.`srId`
WHERE NOT s3Value IS NULL;
INSERT INTO vn.itemTag(itemFk, tagFk, value, priority)
SELECT i.id, t.id , s4Value, 8
FROM itemToInsert ii
JOIN vn.tag t ON t.ediTypeFk = ii.ef4
JOIN vn.item i ON i.supplyResponseFk = ii.`srId`
WHERE NOT s4Value IS NULL;
INSERT INTO vn.itemTag(itemFk, tagFk, value, priority)
SELECT i.id, t.id , s5Value, 9
FROM itemToInsert ii
JOIN vn.tag t ON t.ediTypeFk = ii.ef5
JOIN vn.item i ON i.supplyResponseFk = ii.`srId`
WHERE NOT s5Value IS NULL;
INSERT INTO vn.itemTag(itemFk, tagFk, value, priority)
SELECT i.id, t.id , s6Value, 10
FROM itemToInsert ii
JOIN vn.tag t ON t.ediTypeFk = ii.ef6
JOIN vn.item i ON i.supplyResponseFk = ii.`srId`
WHERE NOT s6Value IS NULL;
INSERT IGNORE INTO vn.itemTag(itemFk, tagFk, value, priority)
SELECT i.id, t.id, IFNULL(ink.name, ik.color), 11
FROM itemToInsert ii
JOIN vn.item i ON i.supplyResponseFk = ii.`srId`
JOIN vn.tag t ON t.`name` = 'Color'
LEFT JOIN edi.feature f ON f.item_id = ii.Item_ArticleCode
LEFT JOIN edi.`type` tp ON tp.type_id = f.feature_type_id
AND tp.`description` = 'Hoofdkleur 1'
LEFT JOIN vn.ink ON ink.dutchCode = f.feature_value
LEFT JOIN vn.itemInk ik ON ik.longName = i.longName
WHERE ink.name IS NOT NULL
OR ik.color IS NOT NULL;
CREATE OR REPLACE TABLE tmp.item
(PRIMARY KEY (id))
SELECT i.id FROM vn.item i
JOIN itemToInsert ii ON i.supplyResponseFk = ii.`srId`;
CALL vn.item_refreshTags();
DROP TABLE tmp.item;
SELECT MIN(LatestDeliveryDateTime) INTO vLanded
FROM edi.supplyResponse sr
JOIN edi.deliveryInformation di ON di.supplyResponseID = sr.ID
JOIN edi.marketPlace mp ON mp.id = sr.MarketPlaceID
JOIN vn.floramondoConfig fc
WHERE mp.isLatestOrderDateTimeRelevant
AND di.LatestOrderDateTime > IF(
fc.MaxLatestOrderHour > HOUR(util.VN_NOW()),
util.VN_CURDATE(),
util.VN_CURDATE() + INTERVAL 1 DAY);
UPDATE vn.floramondoConfig
SET nextLanded = vLanded
WHERE vLanded IS NOT NULL;
-- Elimina la oferta obsoleta
UPDATE vn.buy b
JOIN vn.entry e ON e.id = b.entryFk
JOIN vn.travel tr ON tr.id = e.travelFk
JOIN vn.agencyMode am ON am.id = tr.agencyModeFk
JOIN vn.item i ON i.id = b.itemFk
LEFT JOIN edi.supplyResponse sr ON i.supplyResponseFk = sr.ID
LEFT JOIN edi.deliveryInformation di ON di.ID = b.deliveryFk
SET b.quantity = 0
WHERE (IFNULL(di.LatestOrderDateTime,util.VN_NOW()) <= util.VN_NOW()
OR i.supplyResponseFk IS NULL
OR sr.NumberOfUnits = 0)
AND am.name = 'LOGIFLORA'
AND e.isRaid;
-- Localiza las entradas de cada almacen
UPDATE edi.warehouseFloramondo
SET entryFk = vn.entry_getForLogiflora(vLanded + INTERVAL travellingDays DAY, warehouseFk);
IF vLanded IS NOT NULL THEN
-- Actualiza la oferta existente
UPDATE vn.buy b
JOIN edi.warehouseFloramondo wf ON wf.entryFk = b.entryFk
JOIN vn.item i ON i.id = b.itemFk
JOIN edi.offer o ON i.supplyResponseFk = o.`srId`
SET b.quantity = o.NumberOfUnits * o.NumberOfItemsPerCask,
b.buyingValue = o.price
WHERE (b.quantity <> o.NumberOfUnits * o.NumberOfItemsPerCask
OR b.buyingValue <> o.price);
-- Inserta el resto
SET vLastInserted := util.VN_NOW();
-- Inserta la oferta
INSERT INTO vn.buy (
entryFk,
itemFk,
quantity,
buyingValue,
stickers,
packing,
`grouping`,
groupingMode,
packagingFk,
deliveryFk)
SELECT wf.entryFk,
i.id,
o.NumberOfUnits * o.NumberOfItemsPerCask quantity,
o.Price,
o.NumberOfUnits etiquetas,
o.NumberOfItemsPerCask packing,
GREATEST(1, IFNULL(o.MinimumQuantity,0)) * o.NumberOfItemsPerCask `grouping`,
'packing',
o.embalageCode,
o.diId
FROM edi.offer o
JOIN vn.item i ON i.supplyResponseFk = o.srId
JOIN edi.warehouseFloramondo wf
JOIN vn.packaging p ON p.id
LIKE o.embalageCode
LEFT JOIN vn.buy b ON b.itemFk = i.id
AND b.entryFk = wf.entryFk
WHERE b.id IS NULL; -- Quitar esta linea y mirar de crear los packages a tiempo REAL
INSERT INTO vn.itemCost(
itemFk,
warehouseFk,
cm3,
cm3delivery)
SELECT b.itemFk,
wf.warehouseFk,
@cm3 := vn.buy_getUnitVolume(b.id),
IFNULL((vc.standardFlowerBox * 1000) / i.packingOut, @cm3)
FROM warehouseFloramondo wf
JOIN vn.volumeConfig vc
JOIN vn.buy b ON b.entryFk = wf.entryFk
JOIN vn.item i ON i.id = b.itemFk
LEFT JOIN vn.itemCost ic ON ic.itemFk = b.itemFk
AND ic.warehouseFk = wf.warehouseFk
WHERE (ic.cm3 IS NULL OR ic.cm3 = 0)
ON DUPLICATE KEY UPDATE cm3 = @cm3, cm3delivery = IFNULL((vc.standardFlowerBox * 1000) / i.packingOut, @cm3);
CREATE OR REPLACE TEMPORARY TABLE tmp.buyRecalc
SELECT b.id
FROM vn.buy b
JOIN warehouseFloramondo wf ON wf.entryFk = b.entryFk
WHERE b.created >= vLastInserted;
CALL vn.buy_recalcPrices();
UPDATE edi.offerList o
JOIN (SELECT v.name, COUNT(DISTINCT b.itemFk) total
FROM vn.buy b
JOIN vn.item i ON i.id = b.itemFk
JOIN edi.supplyResponse sr ON sr.ID = i.supplyResponseFk
JOIN edi.VMPSettings v ON v.VMPID = sr.vmpID
JOIN edi.warehouseFloramondo wf ON wf.entryFk = b.entryFk
JOIN vn.warehouse w ON w.id = wf.warehouseFk
WHERE w.name = 'VNH'
AND b.quantity > 0
GROUP BY sr.vmpID) sub ON o.supplier = sub.name
SET o.vnh = sub.total;
UPDATE edi.offerList o
JOIN (SELECT v.name, COUNT(DISTINCT b.itemFk) total
FROM vn.buy b
JOIN vn.item i ON i.id = b.itemFk
JOIN edi.supplyResponse sr ON sr.ID = i.supplyResponseFk
JOIN edi.VMPSettings v ON v.VMPID = sr.vmpID
JOIN edi.warehouseFloramondo wf ON wf.entryFk = b.entryFk
JOIN vn.warehouse w ON w.id = wf.warehouseFk
WHERE w.name = 'ALGEMESI'
AND b.quantity > 0
GROUP BY sr.vmpID) sub ON o.supplier = sub.name
SET o.algemesi = sub.total;
END IF;
DROP TEMPORARY TABLE
edi.offer,
itemToInsert;
SET @isTriggerDisabled = FALSE;
COMMIT;
-- Esto habria que pasarlo a procesos programados o trabajar con tags y dejar las familias
UPDATE vn.item i
SET typeFk = 121
WHERE i.longName LIKE 'Rosa Garden %'
AND typeFk = 17;
UPDATE vn.item i
SET typeFk = 156
WHERE i.longName LIKE 'Rosa ec %'
AND typeFk = 17;
-- Refresca las fotos de los items existentes que mostramos (prioridad baja)
INSERT IGNORE INTO vn.itemImageQueue(itemFk, url, priority)
SELECT i.id, sr.PictureReference, 100
FROM edi.supplyResponse sr
JOIN vn.item i ON i.supplyResponseFk = sr.ID
JOIN edi.supplyOffer so ON so.srId = sr.ID
JOIN hedera.image i2 ON i2.name = i.image
AND i2.collectionFk = 'catalog'
WHERE i2.updated <= (UNIX_TIMESTAMP(util.VN_NOW()) - vDayRange)
AND sr.NumberOfUnits;
INSERT INTO edi.`log`
SET tableName = 'floramondo_offerRefresh',
fieldName = 'Tiempo de proceso',
fieldValue = TIMEDIFF(util.VN_NOW(), vStartingTime);
DO RELEASE_LOCK('edi.floramondo_offerRefresh');
END$$
DELIMITER ;

View File

@ -47,11 +47,15 @@ BEGIN
FROM tmp.zoneGetShipped
WHERE warehouseFk = vWarehouse;
SELECT IFNULL(available, 0) INTO vAvailable
SELECT available INTO vAvailable
FROM tmp.ticketLot
WHERE warehouseFk = vWarehouse
AND itemFk = vItem;
IF vAvailable IS NULL THEN
SET vAvailable = 0;
END IF;
IF vAmount > vAvailable THEN
CALL util.throw ('ORDER_ROW_UNAVAILABLE');
END IF;
@ -102,6 +106,8 @@ BEGIN
amount = vAdd,
price = vPrice;
CALL cache.available_updateItem(vItem, vWarehouse, vShipment, vAdd);
SET vRow = LAST_INSERT_ID();
INSERT INTO orderRowComponent (rowFk, componentFk, price)

View File

@ -0,0 +1,8 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `util`.`log_clean`
ON SCHEDULE EVERY 1 DAY
STARTS '2024-07-09 00:30:00.000'
ON COMPLETION PRESERVE
ENABLE
DO CALL util.log_clean$$
DELIMITER ;

View File

@ -0,0 +1,54 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`log_clean`()
BEGIN
/**
* Hace limpieza de los datos de las tablas log,
* dejando únicamente los días de retención configurados.
*/
DECLARE vSchemaName VARCHAR(65);
DECLARE vSchemaNameQuoted VARCHAR(65);
DECLARE vTableName VARCHAR(65);
DECLARE vTableNameQuoted VARCHAR(65);
DECLARE vRetentionDays INT;
DECLARE vStarted DATETIME;
DECLARE vDated DATE;
DECLARE vDone BOOL;
DECLARE vQueue CURSOR FOR
SELECT schemaName, tableName, retentionDays
FROM logCleanMultiConfig
ORDER BY `order`;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
OPEN vQueue;
l: LOOP
SET vDone = FALSE;
FETCH vQueue INTO vSchemaName, vTableName, vRetentionDays;
IF vDone THEN
LEAVE l;
END IF;
IF vRetentionDays THEN
SET vStarted = VN_NOW();
SET vSchemaNameQuoted = quoteIdentifier(vSchemaName);
SET vTableNameQuoted = quoteIdentifier(vTableName);
SET vDated = VN_CURDATE() - INTERVAL vRetentionDays DAY;
EXECUTE IMMEDIATE CONCAT(
'DELETE FROM ', vSchemaNameQuoted,
'.', vTableNameQuoted,
" WHERE creationDate < '", vDated, "'"
);
UPDATE logCleanMultiConfig
SET `started` = vStarted,
`finished` = VN_NOW()
WHERE schemaName = vSchemaName
AND tableName = vTableName;
END IF;
END LOOP;
CLOSE vQueue;
END$$
DELIMITER ;

View File

@ -1,64 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`entry_getForLogiflora`(vLanded DATE, vWarehouseFk INT)
RETURNS int(11)
NOT DETERMINISTIC
READS SQL DATA
BEGIN
/**
* Devuelve una entrada para Logiflora. Si no existe la crea.
*
* @param vLanded Fecha de llegada al almacén
* @param vWarehouseFk Identificador de vn.warehouse
*/
DECLARE vTravelFk INT;
DECLARE vEntryFk INT;
DECLARE previousEntryFk INT;
SET vTravelFk = vn.travel_getForLogiflora(vLanded, vWarehouseFk);
IF vLanded THEN
SELECT IFNULL(MAX(id),0) INTO vEntryFk
FROM vn.entry
WHERE travelFk = vTravelFk
AND isRaid;
IF NOT vEntryFk THEN
INSERT INTO vn.entry(travelFk, supplierFk, commission, companyFk, currencyFk, isRaid)
SELECT vTravelFk, s.id, 4, c.id, cu.id, TRUE
FROM vn.supplier s
JOIN vn.company c ON c.code = 'VNL'
JOIN vn.currency cu ON cu.code = 'EUR'
WHERE s.name = 'KONINKLIJE COOPERATIEVE BLOEMENVEILING FLORAHOLLAN';
SELECT MAX(id) INTO vEntryFk
FROM vn.entry
WHERE travelFk = vTravelFk;
END IF;
END IF;
SELECT entryFk INTO previousEntryFk
FROM edi.warehouseFloramondo wf
WHERE wf.warehouseFk = vWarehouseFk;
IF IFNULL(previousEntryFk,0) != vEntryFk THEN
UPDATE buy b
SET b.printedStickers = 0
WHERE entryFk = previousEntryFk;
DELETE FROM buy WHERE entryFk = previousEntryFk;
DELETE FROM entry WHERE id = previousEntryFk;
END IF;
RETURN vEntryFk;
END$$
DELIMITER ;

View File

@ -1,52 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`travel_getForLogiflora`(vLanded DATE, vWarehouseFk INT)
RETURNS int(11)
NOT DETERMINISTIC
READS SQL DATA
BEGIN
/**
* Devuelve un número de travel para compras de Logiflora a partir de la fecha de llegada y del almacén.
* Si no existe lo genera.
*
* @param vLanded Fecha de llegada al almacén
* @param vWarehouseFk Identificador de vn.warehouse
*/
DECLARE vTravelFk INT;
IF vLanded THEN
SELECT IFNULL(MAX(tr.id),0) INTO vTravelFk
FROM vn.travel tr
JOIN vn.warehouse wIn ON wIn.id = tr.warehouseInFk
JOIN vn.warehouse wOut ON wOut.id = tr.warehouseOutFk
JOIN vn.agencyMode am ON am.id = tr.agencyModeFk
WHERE wIn.id = vWarehouseFk
AND wOut.name = 'Holanda'
AND am.name = 'LOGIFLORA'
AND landed = vLanded;
IF NOT vTravelFk THEN
INSERT INTO vn.travel(landed, shipped, warehouseInFk, warehouseOutFk, agencyModeFk)
SELECT vLanded, util.VN_CURDATE(), vWarehouseFk, wOut.id, am.id
FROM vn.warehouse wOut
JOIN vn.agencyMode am ON am.name = 'LOGIFLORA'
WHERE wOut.name = 'Holanda';
SELECT MAX(tr.id) INTO vTravelFk
FROM vn.travel tr
JOIN vn.warehouse wIn ON wIn.id = tr.warehouseInFk
JOIN vn.warehouse wOut ON wOut.id = tr.warehouseOutFk
WHERE wIn.id = vWarehouseFk
AND wOut.name = 'Holanda'
AND landed = vLanded;
END IF;
END IF;
RETURN vTravelFk;
END$$
DELIMITER ;

View File

@ -1,18 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`buyUltimate`(
vWarehouseFk SMALLINT,
vDated DATE
)
BEGIN
/**
* @deprecated Usar buy_getUltimate
* Calcula las últimas compras realizadas hasta una fecha.
*
* @param vItemFk Id del artículo
* @param vWarehouseFk Id del almacén
* @param vDated Compras hasta fecha
* @return tmp.buyUltimate
*/
CALL buy_getUltimate(NULL, vWarehouseFk, vDated);
END$$
DELIMITER ;

View File

@ -1,20 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`buyUltimateFromInterval`(
vWarehouseFk SMALLINT,
vStarted DATE,
vEnded DATE
)
BEGIN
/**
* @deprecated Usar buy_getUltimateFromInterval
* Calcula las últimas compras realizadas
* desde un rango de fechas.
*
* @param vWarehouseFk Id del almacén si es NULL se actualizan todos
* @param vStarted Fecha inicial
* @param vEnded Fecha fin
* @return tmp.buyUltimateFromInterval
*/
CALL vn.buy_getUltimateFromInterval(NULL, vWarehouseFk, vStarted, vEnded);
END$$
DELIMITER ;

View File

@ -6,9 +6,10 @@ BEGIN
*
* @param tmp.buysToCheck(id as INT).
*/
DECLARE hasVolumetricAgency INT;
DECLARE vHasVolumetricAgency INT;
DECLARE vItemFk INT;
SELECT a.hasWeightVolumetric INTO hasVolumetricAgency
SELECT a.hasWeightVolumetric, i.id INTO vHasVolumetricAgency, vItemFk
FROM entry e
JOIN travel t ON t.id = e.travelFk
JOIN agencyMode a ON a.id = t.agencyModeFk
@ -21,8 +22,8 @@ BEGIN
DROP TEMPORARY TABLE tmp.buysToCheck;
IF hasVolumetricAgency THEN
CALL util.throw('Item lacks size/weight in purchase line at agency');
IF vHasVolumetricAgency THEN
CALL util.throw(CONCAT('Missing size/weight in buy line at agency, item: ', vItemFk));
END IF;
END$$
DELIMITER ;

View File

@ -167,7 +167,8 @@ BEGIN
OR LENGTH(pb.problem)
OR pb.lines > vLinesLimit
OR pb.m3 > vVolumeLimit
OR sub.maxSize > vSizeLimit;
OR sub.maxSize > vSizeLimit
OR pb.hasPlantTray;
END IF;
-- Hay que excluir aquellos que no tengan la misma hora de preparacion, si procede

View File

@ -10,7 +10,7 @@ BEGIN
SELECT * FROM (
SELECT cc.client clientFk, ci.grade
FROM creditClassification cc
JOIN creditInsurance ci ON cc.id = ci.creditClassification
JOIN creditInsurance ci ON cc.id = ci.creditClassificationFk
WHERE dateEnd IS NULL
ORDER BY ci.creationDate DESC
LIMIT 10000000000000000000) t1

View File

@ -30,6 +30,8 @@ BEGIN
FROM operator
WHERE workerFk = account.myUser_getId();
CALL util.debugAdd('itemShelvingSale_addBySectorCollection',CONCAT(vSectorCollectionFk,' - ', account.myUser_getId()));
OPEN vSales;
l: LOOP
SET vDone = FALSE;

View File

@ -46,7 +46,8 @@ BEGIN
AND buyFk = vBuyFk) THEN
UPDATE itemShelving
SET visible = visible + vQuantity
SET visible = visible + vQuantity,
available = available + vQuantity
WHERE shelvingFk COLLATE utf8_unicode_ci = vShelvingFk AND itemFk = vItemFk AND packing = vPacking;
ELSE

View File

@ -211,8 +211,6 @@ proc: BEGIN
salesInParkingCount INT DEFAULT 0)
ENGINE = MEMORY;
-- Insertamos todos los tickets que tienen productos parkineados
-- en sectores de previa, segun el sector
CREATE OR REPLACE TEMPORARY TABLE tItemShelvingStock
(PRIMARY KEY(itemFk, sectorFk))
ENGINE = MEMORY
@ -245,7 +243,6 @@ proc: BEGIN
AND s.quantity > 0
GROUP BY pb.ticketFk;
-- Se calcula la cantidad de productos que estan ya preparados porque su saleGroup está aparcado
UPDATE tmp.ticketWithPrevia twp
JOIN (
SELECT pb.ticketFk, COUNT(DISTINCT s.id) salesInParkingCount
@ -259,12 +256,28 @@ proc: BEGIN
) sub ON twp.ticketFk = sub.ticketFk
SET twp.salesInParkingCount = sub.salesInParkingCount;
-- Marcamos como pendientes aquellos que no coinciden las cantidades
UPDATE tmp.productionBuffer pb
JOIN tmp.ticketWithPrevia twp ON twp.ticketFk = pb.ticketFk
SET pb.previousWithoutParking = TRUE
WHERE twp.salesCount > twp.salesInParkingCount;
-- hasPlantTray
ALTER TABLE tmp.productionBuffer
ADD hasPlantTray BOOL DEFAULT FALSE;
UPDATE tmp.productionBuffer pb
JOIN sale s ON s.ticketFk = pb.ticketFk
JOIN item i ON i.id = s.itemFk
JOIN itemType it ON it.id = i.typeFk
JOIN itemCategory ic ON ic.id = it.categoryFk
JOIN cache.last_buy lb ON lb.warehouse_id = vWarehouseFk AND lb.item_id = s.itemFk
JOIN buy b ON b.id = lb.buy_id
JOIN packaging p ON p.id = b.packagingFk
JOIN productionConfig pc
SET hasPlantTray = TRUE
WHERE ic.code = 'plant'
AND p.`depth` >= pc.minPlantTrayLength;
DROP TEMPORARY TABLE
tmp.productionTicket,
tmp.ticket,

View File

@ -55,7 +55,6 @@ BEGIN
i.itemPackingTypeFk,
isa.`size`,
isa.Estado,
isa.sectorProdPriority,
isa.available,
isa.sectorFk,
isa.matricula,

View File

@ -160,7 +160,10 @@ w1: WHILE vQuantity >= vPacking DO
UPDATE sale SET quantity = quantity - vPacking WHERE id = vSaleFk;
UPDATE itemShelving SET visible = visible - vPacking WHERE id = vItemShelvingFk;
UPDATE itemShelving
SET visible = visible - vPacking,
available = available - vPacking
WHERE id = vItemShelvingFk;
SET vNewSaleFk = NULL;

View File

@ -51,7 +51,6 @@ BEGIN
hasTicketRequest,
isTaxDataChecked,
hasComponentLack,
hasRounding,
isTooLittle)
SELECT sgp.ticketFk,
s.id,
@ -62,10 +61,6 @@ BEGIN
IF(FIND_IN_SET('hasTicketRequest', t.problem), TRUE, FALSE) hasTicketRequest,
IF(FIND_IN_SET('isTaxDataChecked', t.problem), FALSE, TRUE) isTaxDataChecked,
IF(FIND_IN_SET('hasComponentLack', s.problem), TRUE, FALSE) hasComponentLack,
IF(FIND_IN_SET('hasRounding', s.problem),
LEFT(GROUP_CONCAT('RE: ', i.id, ' ', IFNULL(i.longName,'') SEPARATOR ', '), 250),
NULL
) hasRounding,
IF(FIND_IN_SET('isTooLittle', t.problem)
AND util.VN_NOW() < (util.VN_CURDATE() + INTERVAL HOUR(zc.`hour`) HOUR) + INTERVAL MINUTE(zc.`hour`) MINUTE,
TRUE, FALSE) isTooLittle
@ -208,9 +203,9 @@ BEGIN
GROUP BY sgp.ticketFk
) sub
ON DUPLICATE KEY UPDATE itemDelay = sub.problem, saleFk = sub.saleFk;
END LOOP;
CLOSE vCursor;
-- Redondeo: cantidad incorrecta con respecto al grouping
CALL buy_getUltimate(NULL, vWarehouseFk, vDate);
INSERT INTO tmp.sale_problems(ticketFk, hasRounding, saleFk)
SELECT ticketFk, problem, saleFk
FROM (
@ -219,13 +214,20 @@ BEGIN
LEFT(GROUP_CONCAT('RE: ',i.id, ' ', IFNULL(i.longName,'') SEPARATOR ', '), 250) problem
FROM tmp.sale_getProblems sgp
JOIN ticket t ON t.id = sgp.ticketFk
AND t.warehouseFk = vWarehouseFk
JOIN sale s ON s.ticketFk = sgp.ticketFk
JOIN item i ON i.id = s.itemFk
WHERE FIND_IN_SET('hasRounding', s.problem)
JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk
JOIN buy b ON b.id = bu.buyFk
WHERE MOD(s.quantity, b.`grouping`)
GROUP BY sgp.ticketFk
)sub
ON DUPLICATE KEY UPDATE hasRounding = sub.problem, saleFk = sub.saleFk;
DROP TEMPORARY TABLE tmp.buyUltimate;
END LOOP;
CLOSE vCursor;
DROP TEMPORARY TABLE tItemShelvingStock_byWarehouse;
END$$
DELIMITER ;

View File

@ -1,37 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`sale_setProblemRounding`(
vSelf INT
)
BEGIN
/**
* Update the rounding problem for a sales line
* @param vSelf Id sale
*/
DECLARE vItemFk INT;
DECLARE vWarehouseFk INT;
DECLARE vShipped DATE;
DECLARE vQuantity INT;
DECLARE vIsProblemCalcNeeded BOOL;
SELECT s.itemFk, t.warehouseFk, t.shipped, s.quantity, ticket_isProblemCalcNeeded(t.id)
INTO vItemFk, vWarehouseFk, vShipped, vQuantity, vIsProblemCalcNeeded
FROM sale s
JOIN ticket t ON t.id = s.ticketFk
WHERE s.id = vSelf;
CALL buy_getUltimate(vItemFk, vWarehouseFk, vShipped);
CREATE OR REPLACE TEMPORARY TABLE tmp.sale
SELECT vSelf saleFk,
MOD(vQuantity, b.`grouping`) hasProblem,
vIsProblemCalcNeeded isProblemCalcNeeded
FROM tmp.buyUltimate bu
JOIN buy b ON b.id = bu.buyFk
WHERE bu.itemFk = vItemFk;
CALL sale_setProblem('hasRounding');
DROP TEMPORARY TABLE tmp.sale;
DROP TEMPORARY TABLE tmp.buyUltimate;
END$$
DELIMITER ;

View File

@ -1,75 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sale_setProblemRoundingByBuy`(
vBuyFk INT
)
BEGIN
/**
* Update rounding problem for all sales related to a buy.
*
* @param vBuyFk Buy id
*/
DECLARE vItemFk INT;
DECLARE vWarehouseFk INT;
DECLARE vMaxDated DATE;
DECLARE vMinDated DATE;
DECLARE vLanding DATE;
DECLARE vLastBuy INT;
DECLARE vCurrentBuy INT;
DECLARE vGrouping INT;
SELECT b.itemFk, t.warehouseInFk
INTO vItemFk, vWarehouseFk
FROM buy b
JOIN entry e ON e.id = b.entryFk
JOIN travel t ON t.id = e.travelFk
WHERE b.id = vBuyFk;
IF vItemFk AND vWarehouseFk THEN
SELECT DATE(MAX(t.shipped)) + INTERVAL 1 DAY, DATE(MIN(t.shipped))
INTO vMaxDated, vMinDated
FROM sale s
JOIN ticket t ON t.id = s.ticketFk
WHERE t.shipped >= util.VN_CURDATE()
AND s.itemFk = vItemFk
AND s.quantity > 0;
CALL buy_getUltimate(vItemFk, vWarehouseFk, vMinDated);
SELECT bu.buyFk, b.grouping INTO vLastBuy, vGrouping
FROM tmp.buyUltimate bu
JOIN buy b ON b.id = bu.buyFk;
DROP TEMPORARY TABLE tmp.buyUltimate;
SET vLanding = vMaxDated;
WHILE vCurrentBuy <> vLastBuy OR vLanding > vMinDated DO
SET vMaxDated = vLanding - INTERVAL 1 DAY;
CALL buy_getUltimate(vItemFk, vWarehouseFk, vMaxDated);
SELECT buyFk, landing
INTO vCurrentBuy, vLanding
FROM tmp.buyUltimate;
DROP TEMPORARY TABLE tmp.buyUltimate;
END WHILE;
CREATE OR REPLACE TEMPORARY TABLE tmp.sale
(INDEX(saleFk, isProblemCalcNeeded))
ENGINE = MEMORY
SELECT s.id saleFk,
MOD(s.quantity, vGrouping) hasProblem,
ticket_isProblemCalcNeeded(t.id) isProblemCalcNeeded
FROM sale s
JOIN ticket t ON t.id = s.ticketFk
WHERE s.itemFk = vItemFk
AND s.quantity > 0
AND t.shipped BETWEEN vMinDated AND util.dayEnd(vMaxDated);
CALL sale_setProblem('hasRounding');
DROP TEMPORARY TABLE tmp.sale;
END IF;
END$$
DELIMITER ;

View File

@ -19,8 +19,7 @@ BEGIN
CREATE OR REPLACE TEMPORARY TABLE tmp.filter
(INDEX (id))
SELECT
origin.ticketFk futureId,
SELECT origin.ticketFk futureId,
dest.ticketFk id,
dest.state,
origin.futureState,
@ -51,10 +50,10 @@ BEGIN
origin.warehouseFk futureWarehouseFk,
origin.companyFk futureCompanyFk,
IFNULL(dest.nickname, origin.nickname) nickname,
dest.landed
dest.landed,
dest.preparation
FROM (
SELECT
s.ticketFk,
SELECT s.ticketFk,
c.salesPersonFk workerFk,
t.shipped,
t.totalWithVat,
@ -79,9 +78,10 @@ BEGIN
JOIN saleVolume sv ON sv.saleFk = s.id
JOIN item i ON i.id = s.itemFk
JOIN ticketState ts ON ts.ticketFk = t.id
JOIN state st ON st.id = ts.stateFk
JOIN `state` st ON st.id = ts.stateFk
JOIN agencyMode am ON t.agencyModeFk = am.id
JOIN zone z ON t.zoneFk = z.id
JOIN `zone` z ON t.zoneFk = z.id
LEFT JOIN zoneClosure zc ON zc.zoneFk = t.zoneFk
LEFT JOIN itemPackingType ipt ON ipt.code = i.itemPackingTypeFk
LEFT JOIN tmp.itemMinacum im ON im.itemFk = i.id
AND im.warehouseFk = vWarehouseFk
@ -91,8 +91,7 @@ BEGIN
GROUP BY t.id
) origin
LEFT JOIN (
SELECT
t.id ticketFk,
SELECT t.id ticketFk,
st.name state,
GROUP_CONCAT(DISTINCT ipt.code ORDER BY ipt.code) ipt,
t.shipped,
@ -108,18 +107,25 @@ BEGIN
t.warehouseFk,
t.companyFk,
t.landed,
t.agencyModeFk
t.agencyModeFk,
SEC_TO_TIME(
COALESCE(HOUR(t.shipped), HOUR(zc.hour), HOUR(z.hour)) * 3600 +
COALESCE(MINUTE(t.shipped), MINUTE(zc.hour), MINUTE(z.hour)) * 60
) preparation
FROM ticket t
JOIN sale s ON s.ticketFk = t.id
JOIN saleVolume sv ON sv.saleFk = s.id
JOIN item i ON i.id = s.itemFk
JOIN ticketState ts ON ts.ticketFk = t.id
JOIN state st ON st.id = ts.stateFk
JOIN `state` st ON st.id = ts.stateFk
JOIN agencyMode am ON t.agencyModeFk = am.id
LEFT JOIN itemPackingType ipt ON ipt.code = i.itemPackingTypeFk
LEFT JOIN `zone` z ON z.id = t.zoneFk
LEFT JOIN zoneClosure zc ON zc.zoneFk = t.zoneFk
JOIN ticketCanAdvanceConfig tc
WHERE t.shipped BETWEEN vDateToAdvance AND util.dayend(vDateToAdvance)
AND t.warehouseFk = vWarehouseFk
AND st.order <= 5
AND st.order <= tc.destinationOrder
GROUP BY t.id
) dest ON dest.addressFk = origin.addressFk
WHERE origin.hasStock;

View File

@ -21,6 +21,7 @@ BEGIN
t.clientFk,
t.warehouseFk,
ts.alertLevel,
sub2.alertLevel futureAlertLevel,
t.shipped,
t.totalWithVat,
sub2.shipped futureShipped,
@ -47,6 +48,7 @@ BEGIN
t.addressFk,
t.id,
t.shipped,
ts.alertLevel,
st.name state,
st.code,
st.classColor,

View File

@ -17,6 +17,7 @@ BEGIN
DECLARE vHasDailyInvoice BOOL;
DECLARE vWithPackage BOOL;
DECLARE vHasToInvoice BOOL;
DECLARE vSerial VARCHAR(2);
DECLARE cur CURSOR FOR
SELECT ticketFk FROM tmp.ticket_close;
@ -83,14 +84,17 @@ BEGIN
GROUP BY e.freightItemFk);
IF(vHasDailyInvoice) AND vHasToInvoice THEN
SELECT invoiceSerial(vClientFk, vCompanyFk, 'quick') INTO vSerial;
IF vSerial IS NULL THEN
CALL util.throw('Cannot booking without a serial');
END IF;
-- Facturacion rapida
CALL ticket_setState(vCurTicketFk, 'DELIVERED');
-- Facturar si está contabilizado
IF vIsTaxDataChecked THEN
CALL invoiceOut_newFromClient(
vClientFk,
(SELECT invoiceSerial(vClientFk, vCompanyFk, 'multiple')),
vSerial,
vShipped,
vCompanyFk,
NULL,

View File

@ -36,7 +36,7 @@ BEGIN
UPDATE tmp.ticket_problems
SET totalProblems = (
(isFreezed) +
(hasRisk) +
(hasHighRisk) +
(hasTicketRequest) +
(!isTaxDataChecked) +
(hasComponentLack) +

View File

@ -1,37 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_setProblemRounding`(
vSelf INT
)
BEGIN
/**
* Update the rounding problem for the sales lines of a ticket
*
* @param vSelf Id de ticket
*/
DECLARE vWarehouseFk INT;
DECLARE vDated DATE;
SELECT warehouseFk, shipped
INTO vWarehouseFk, vDated
FROM ticket
WHERE id = vSelf;
CALL buy_getUltimate(NULL, vWarehouseFk, vDated);
CREATE OR REPLACE TEMPORARY TABLE tmp.sale
(INDEX(saleFk, isProblemCalcNeeded))
SELECT s.id saleFk ,
MOD(s.quantity, b.`grouping`) hasProblem,
ticket_isProblemCalcNeeded(t.id) isProblemCalcNeeded
FROM ticket t
JOIN sale s ON s.ticketFk = t.id
JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk
JOIN buy b ON b.id = bu.buyFk
WHERE t.id = vSelf;
CALL sale_setProblem('hasRounding');
DROP TEMPORARY TABLE tmp.sale;
DROP TEMPORARY TABLE tmp.buyUltimate;
END$$
DELIMITER ;

View File

@ -5,7 +5,7 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`creditInsurance_afterIn
BEGIN
UPDATE `client` c
JOIN vn.creditClassification cc ON cc.client = c.id
SET creditInsurance = NEW.credit WHERE cc.id = NEW.creditClassification;
SET creditInsurance = NEW.credit WHERE cc.id = NEW.creditClassificationFk;
END$$
DELIMITER ;

View File

@ -1,10 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`creditInsurance_beforeInsert`
BEFORE INSERT ON `creditInsurance`
FOR EACH ROW
BEGIN
IF NEW.creditClassificationFk THEN
SET NEW.creditClassification = NEW.creditClassificationFk;
END IF;
END$$
DELIMITER ;

View File

@ -5,7 +5,7 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`solunionCAP_afterInsert
BEGIN
UPDATE client c
JOIN creditClassification cc ON cc.client = c.id
JOIN creditInsurance ci ON ci.creditClassification = cc.id
JOIN creditInsurance ci ON ci.creditClassificationFk = cc.id
SET creditInsurance = ci.credit * 2 WHERE ci.id = NEW.creditInsurance;
END$$
DELIMITER ;

View File

@ -6,12 +6,12 @@ BEGIN
IF NEW.dateLeaving IS NOT NULL THEN
UPDATE client c
JOIN creditClassification cc ON cc.client = c.id
JOIN creditInsurance ci ON ci.creditClassification = cc.id
JOIN creditInsurance ci ON ci.creditClassificationFk = cc.id
SET creditInsurance = ci.credit WHERE ci.id = OLD.creditInsurance;
ELSE
UPDATE client c
JOIN creditClassification cc ON cc.client = c.id
JOIN creditInsurance ci ON ci.creditClassification = cc.id
JOIN creditInsurance ci ON ci.creditClassificationFk = cc.id
SET creditInsurance = ci.credit * 2 WHERE ci.id = OLD.creditInsurance;
END IF;
END$$

View File

@ -5,7 +5,7 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`solunionCAP_beforeDelet
BEGIN
UPDATE client c
JOIN creditClassification cc ON cc.client = c.id
JOIN creditInsurance ci ON ci.creditClassification = cc.id
JOIN creditInsurance ci ON ci.creditClassificationFk = cc.id
SET creditInsurance = ci.credit WHERE ci.id = OLD.creditInsurance;
END$$
DELIMITER ;

View File

@ -1,11 +1,11 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`workerDocument_afterDelete`
AFTER DELETE ON `workerDocument`
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`workerDms_afterDelete`
AFTER DELETE ON `workerDms`
FOR EACH ROW
BEGIN
INSERT INTO workerLog
SET `action` = 'delete',
`changedModel` = 'WorkerDocument',
`changedModel` = 'WorkerDms',
`changedModelId` = OLD.id,
`userFk` = account.myUser_getId();
END$$

View File

@ -1,6 +1,6 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`workerDocument_beforeUpdate`
BEFORE UPDATE ON `workerDocument`
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`workerDms_beforeInsert`
BEFORE INSERT ON `workerDms`
FOR EACH ROW
BEGIN
SET NEW.editorFk = account.myUser_getId();

View File

@ -1,6 +1,6 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`workerDocument_beforeInsert`
BEFORE INSERT ON `workerDocument`
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`workerDms_beforeUpdate`
BEFORE UPDATE ON `workerDms`
FOR EACH ROW
BEGIN
SET NEW.editorFk = account.myUser_getId();

View File

@ -10,7 +10,6 @@ AS SELECT `s`.`id` AS `saleFk`,
`s`.`concept` AS `concept`,
`i`.`size` AS `size`,
`st`.`name` AS `Estado`,
`st`.`sectorProdPriority` AS `sectorProdPriority`,
`stock`.`visible` AS `available`,
`stock`.`sectorFk` AS `sectorFk`,
`stock`.`shelvingFk` AS `matricula`,

View File

@ -6,7 +6,6 @@ AS SELECT `s`.`id` AS `id`,
`s`.`order` AS `order`,
`s`.`alertLevel` AS `alert_level`,
`s`.`code` AS `code`,
`s`.`sectorProdPriority` AS `sectorProdPriority`,
`s`.`nextStateFk` AS `nextStateFk`,
`s`.`isPreviousPreparable` AS `isPreviousPreparable`,
`s`.`isPicked` AS `isPicked`

View File

@ -0,0 +1,19 @@
ALTER TABLE vn.collectionWagonTicket DROP FOREIGN KEY IF EXISTS collectionWagonTicket_tray;
ALTER TABLE vn.wagonConfig DROP FOREIGN KEY IF EXISTS wagonConfig_wagonTypeColor_FK;
CREATE OR REPLACE TABLE vn.wagonTypeTray (
id INT(11) UNSIGNED,
wagonTypeFk INT(11) unsigned NULL,
height INT(11) UNSIGNED NULL,
wagonTypeColorFk int(11) unsigned NULL,
CONSTRAINT wagonTypeTray_pk PRIMARY KEY (id),
CONSTRAINT wagonTypeTray_wagonType_FK FOREIGN KEY (wagonTypeFk) REFERENCES vn.wagonType(id) ON DELETE CASCADE ON UPDATE RESTRICT,
CONSTRAINT wagonTypeTray_wagonTypeColor_FK FOREIGN KEY (wagonTypeColorFk) REFERENCES vn.wagonTypeColor(id)
)
ENGINE=InnoDB
DEFAULT CHARSET=utf8mb3
COLLATE=utf8mb3_unicode_ci;
ALTER TABLE vn.wagonConfig ADD IF NOT EXISTS defaultHeight INT UNSIGNED DEFAULT 0 NULL COMMENT 'Default height in cm for a base tray';
ALTER TABLE vn.wagonConfig ADD IF NOT EXISTS defaultTrayColorFk int(11) unsigned NULL COMMENT 'Default color for a base tray';
ALTER TABLE vn.wagonConfig ADD CONSTRAINT wagonConfig_wagonTypeColor_FK FOREIGN KEY (defaultTrayColorFk) REFERENCES vn.wagonTypeColor(id);
ALTER TABLE vn.collectionWagonTicket ADD CONSTRAINT collectionWagonTicket_tray FOREIGN KEY (trayFk) REFERENCES vn.wagonTypeTray(id);

View File

@ -0,0 +1,13 @@
CREATE OR REPLACE TABLE `util`.`logCleanMultiConfig` (
`schemaName` varchar(64) NOT NULL,
`tableName` varchar(64) NOT NULL,
`retentionDays` int(11) DEFAULT NULL,
`order` int(11) DEFAULT NULL,
`started` datetime DEFAULT NULL,
`finished` datetime DEFAULT NULL,
PRIMARY KEY (`schemaName`,`tableName`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
INSERT INTO `util`.`logCleanMultiConfig` (`schemaName`, `tableName`)
SELECT TABLE_SCHEMA, TABLE_NAME FROM information_schema.`COLUMNS`
WHERE COLUMN_NAME IN ('newInstance', 'newInstance');

View File

@ -0,0 +1 @@
CREATE INDEX userLog_creationDate_IDX USING BTREE ON account.userLog (creationDate DESC);

View File

@ -0,0 +1 @@
CREATE INDEX roleLog_creationDate_IDX USING BTREE ON account.roleLog (creationDate DESC);

View File

@ -0,0 +1 @@
CREATE INDEX ACLLog_creationDate_IDX USING BTREE ON salix.ACLLog (creationDate DESC);

View File

@ -0,0 +1 @@
CREATE INDEX supplierLog_creationDate_IDX USING BTREE ON vn.supplierLog (creationDate DESC);

View File

@ -0,0 +1 @@
CREATE INDEX deviceProductionLog_creationDate_IDX USING BTREE ON vn.deviceProductionLog (creationDate DESC);

View File

@ -0,0 +1 @@
CREATE INDEX routeLog_creationDate_IDX USING BTREE ON vn.routeLog (creationDate DESC);

View File

@ -0,0 +1 @@
CREATE INDEX itemLog_creationDate_IDX USING BTREE ON vn.itemLog (creationDate DESC);

View File

@ -0,0 +1 @@
CREATE INDEX userLog_creationDate_IDX USING BTREE ON vn.userLog (creationDate DESC);

View File

@ -0,0 +1 @@
CREATE INDEX invoiceInLog_creationDate_IDX USING BTREE ON vn.invoiceInLog (creationDate DESC);

View File

@ -0,0 +1 @@
CREATE INDEX zoneLog_creationDate_IDX USING BTREE ON vn.zoneLog (creationDate DESC);

View File

@ -0,0 +1 @@
CREATE INDEX clientLog_creationDate_IDX USING BTREE ON vn.clientLog (creationDate DESC);

View File

@ -0,0 +1 @@
CREATE INDEX workerLog_creationDate_IDX USING BTREE ON vn.workerLog (creationDate DESC);

View File

@ -0,0 +1 @@
CREATE INDEX rateLog_creationDate_IDX USING BTREE ON vn.rateLog (creationDate DESC);

View File

@ -0,0 +1 @@
CREATE INDEX claimLog_creationDate_IDX USING BTREE ON vn.claimLog (creationDate DESC);

View File

@ -0,0 +1 @@
CREATE INDEX packingSiteDeviceLog_creationDate_IDX USING BTREE ON vn.packingSiteDeviceLog (creationDate DESC);

View File

@ -0,0 +1 @@
CREATE INDEX travelLog_creationDate_IDX USING BTREE ON vn.travelLog (creationDate DESC);

View File

@ -0,0 +1 @@
CREATE INDEX shelvingLog_creationDate_IDX USING BTREE ON vn.shelvingLog (creationDate DESC);

View File

@ -0,0 +1 @@
CREATE INDEX productionConfigLog_creationDate_IDX USING BTREE ON vn.productionConfigLog (creationDate DESC);

View File

@ -0,0 +1 @@
CREATE INDEX entryLog_creationDate_IDX USING BTREE ON vn.entryLog (creationDate DESC);

View File

@ -0,0 +1 @@
CREATE INDEX agencyLog_creationDate_IDX USING BTREE ON vn.agencyLog (creationDate DESC);

View File

@ -0,0 +1 @@
CREATE INDEX parkingLog_creationDate_IDX USING BTREE ON vn.parkingLog (creationDate DESC);

View File

@ -0,0 +1 @@
CREATE INDEX bufferLog_creationDate_IDX USING BTREE ON srt.bufferLog (creationDate DESC);

View File

@ -0,0 +1,13 @@
UPDATE `salix`.`ACL`
SET accessType='READ'
WHERE model = 'ACL';
UPDATE `salix`.`ACL`
SET principalId='developerBoss'
WHERE model = 'AccessToken';
INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId)
VALUES
('VnToken', '*', 'READ', 'ALLOW', 'ROLE', 'developer'),
('VnToken', 'killSession', '*', 'ALLOW', 'ROLE', 'developer'),
('ACL', '*', 'WRITE', 'ALLOW', 'ROLE', 'developerBoss');

View File

@ -0,0 +1,16 @@
ALTER TABLE IF EXISTS `vn`.`payrollWorker`
MODIFY COLUMN IF EXISTS `nss__` varchar(23) NOT NULL COMMENT '@deprecated 2024-03-15',
MODIFY COLUMN IF EXISTS `codpuesto__` int(10) NOT NULL COMMENT '@deprecated 2024-03-15',
MODIFY COLUMN IF EXISTS `codcontrato__` int(10) NOT NULL COMMENT '@deprecated 2024-03-15',
MODIFY COLUMN IF EXISTS `FAntiguedad__` date NOT NULL COMMENT '@deprecated 2024-03-15',
MODIFY COLUMN IF EXISTS `grupotarifa__` int(10) NOT NULL COMMENT '@deprecated 2024-03-15',
MODIFY COLUMN IF EXISTS `codcategoria__` int(10) NOT NULL COMMENT '@deprecated 2024-03-15',
MODIFY COLUMN IF EXISTS `ContratoTemporal__` tinyint(1) NOT NULL DEFAULT 0 COMMENT '@deprecated 2024-03-15';
ALTER TABLE IF EXISTS `vn`.`payrollWorkCenter`
MODIFY COLUMN IF EXISTS `Centro__` varchar(255) NOT NULL COMMENT '@deprecated 2024-03-15',
MODIFY COLUMN IF EXISTS `nss_cotizacion__` varchar(15) NOT NULL COMMENT '@deprecated 2024-03-15',
MODIFY COLUMN IF EXISTS `domicilio__` varchar(255) NOT NULL COMMENT '@deprecated 2024-03-15',
MODIFY COLUMN IF EXISTS `poblacion__` varchar(45) NOT NULL COMMENT '@deprecated 2024-03-15',
MODIFY COLUMN IF EXISTS `cp__` varchar(5) NOT NULL COMMENT '@deprecated 2024-03-15',
MODIFY COLUMN IF EXISTS `empresa_id__` int(10) NOT NULL COMMENT '@deprecated 2024-03-15';

View File

@ -1,4 +1,5 @@
-- Calculamos todos los volumenes de todos los tickets una sola vez
/* Se ejecutará el dia de test - master manualmente para no hacer lenta la subida
CREATE OR REPLACE TEMPORARY TABLE tmp.tTicketVolume
(PRIMARY KEY (id))
ENGINE = MEMORY
@ -14,3 +15,4 @@ UPDATE vn.ticket t
SET t.volume = tv.volume;
DROP TEMPORARY TABLE tmp.tTicketVolume;
*/

View File

@ -0,0 +1,9 @@
-- Place your SQL code here
INSERT INTO salix.ACL
SET model = 'Ticket',
property = 'setWeight',
accessType = 'WRITE',
permission = 'ALLOW',
principalType = 'ROLE',
principalId = 'salesPerson';

View File

@ -0,0 +1 @@
ALTER TABLE vn.parking ADD COLUMN floor VARCHAR(5) DEFAULT NULL AFTER row;

View File

@ -0,0 +1,129 @@
use vn;
CREATE TABLE IF NOT EXISTS `material` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(50) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name_UNIQUE` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
INSERT IGNORE INTO `material` (`name`) VALUES ('Abedul');
INSERT IGNORE INTO `material` (`name`) VALUES ('Acacia');
INSERT IGNORE INTO `material` (`name`) VALUES ('Acero');
INSERT IGNORE INTO `material` (`name`) VALUES ('Acero Galvanizado');
INSERT IGNORE INTO `material` (`name`) VALUES ('Acetato');
INSERT IGNORE INTO `material` (`name`) VALUES ('Acrílico');
INSERT IGNORE INTO `material` (`name`) VALUES ('Alambre');
INSERT IGNORE INTO `material` (`name`) VALUES ('Algodón');
INSERT IGNORE INTO `material` (`name`) VALUES ('Aluminio');
INSERT IGNORE INTO `material` (`name`) VALUES ('Antracita');
INSERT IGNORE INTO `material` (`name`) VALUES ('Arcilla');
INSERT IGNORE INTO `material` (`name`) VALUES ('Bambú');
INSERT IGNORE INTO `material` (`name`) VALUES ('Banano');
INSERT IGNORE INTO `material` (`name`) VALUES ('Canneté');
INSERT IGNORE INTO `material` (`name`) VALUES ('Cartón');
INSERT IGNORE INTO `material` (`name`) VALUES ('Cartulina');
INSERT IGNORE INTO `material` (`name`) VALUES ('Celofán');
INSERT IGNORE INTO `material` (`name`) VALUES ('Cemento');
INSERT IGNORE INTO `material` (`name`) VALUES ('Cera');
INSERT IGNORE INTO `material` (`name`) VALUES ('Cerámica');
INSERT IGNORE INTO `material` (`name`) VALUES ('Chapa');
INSERT IGNORE INTO `material` (`name`) VALUES ('Chenilla');
INSERT IGNORE INTO `material` (`name`) VALUES ('Cloruro de polivinilo');
INSERT IGNORE INTO `material` (`name`) VALUES ('Cobre');
INSERT IGNORE INTO `material` (`name`) VALUES ('Corcho');
INSERT IGNORE INTO `material` (`name`) VALUES ('Cordel');
INSERT IGNORE INTO `material` (`name`) VALUES ('Cotton');
INSERT IGNORE INTO `material` (`name`) VALUES ('Cotton Chess');
INSERT IGNORE INTO `material` (`name`) VALUES ('Cristal');
INSERT IGNORE INTO `material` (`name`) VALUES ('Cubo Asa');
INSERT IGNORE INTO `material` (`name`) VALUES ('Cuerda');
INSERT IGNORE INTO `material` (`name`) VALUES ('Cuero');
INSERT IGNORE INTO `material` (`name`) VALUES ('Doble Raso');
INSERT IGNORE INTO `material` (`name`) VALUES ('Doble Velvet');
INSERT IGNORE INTO `material` (`name`) VALUES ('Eco Glass');
INSERT IGNORE INTO `material` (`name`) VALUES ('Encaje');
INSERT IGNORE INTO `material` (`name`) VALUES ('Esparto');
INSERT IGNORE INTO `material` (`name`) VALUES ('Espuma');
INSERT IGNORE INTO `material` (`name`) VALUES ('Felpa');
INSERT IGNORE INTO `material` (`name`) VALUES ('Fibra');
INSERT IGNORE INTO `material` (`name`) VALUES ('Fibra de Coco');
INSERT IGNORE INTO `material` (`name`) VALUES ('Fibra de Vidrio y Resina');
INSERT IGNORE INTO `material` (`name`) VALUES ('Fieltro');
INSERT IGNORE INTO `material` (`name`) VALUES ('Foam');
INSERT IGNORE INTO `material` (`name`) VALUES ('Gamuza');
INSERT IGNORE INTO `material` (`name`) VALUES ('Gasa');
INSERT IGNORE INTO `material` (`name`) VALUES ('Glass');
INSERT IGNORE INTO `material` (`name`) VALUES ('Goma');
INSERT IGNORE INTO `material` (`name`) VALUES ('Grafito');
INSERT IGNORE INTO `material` (`name`) VALUES ('Hierro');
INSERT IGNORE INTO `material` (`name`) VALUES ('Hoja Carbono');
INSERT IGNORE INTO `material` (`name`) VALUES ('Hoja de Mirto');
INSERT IGNORE INTO `material` (`name`) VALUES ('Hormigón');
INSERT IGNORE INTO `material` (`name`) VALUES ('Jute');
INSERT IGNORE INTO `material` (`name`) VALUES ('Kraft');
INSERT IGNORE INTO `material` (`name`) VALUES ('Lana');
INSERT IGNORE INTO `material` (`name`) VALUES ('Látex');
INSERT IGNORE INTO `material` (`name`) VALUES ('Latrix');
INSERT IGNORE INTO `material` (`name`) VALUES ('Lienzo');
INSERT IGNORE INTO `material` (`name`) VALUES ('Lino');
INSERT IGNORE INTO `material` (`name`) VALUES ('Lurex');
INSERT IGNORE INTO `material` (`name`) VALUES ('Madera');
INSERT IGNORE INTO `material` (`name`) VALUES ('Metacrilato');
INSERT IGNORE INTO `material` (`name`) VALUES ('Metal');
INSERT IGNORE INTO `material` (`name`) VALUES ('Mimbre');
INSERT IGNORE INTO `material` (`name`) VALUES ('Musgo');
INSERT IGNORE INTO `material` (`name`) VALUES ('Nonwoven');
INSERT IGNORE INTO `material` (`name`) VALUES ('Nylon');
INSERT IGNORE INTO `material` (`name`) VALUES ('Organza');
INSERT IGNORE INTO `material` (`name`) VALUES ('Paja');
INSERT IGNORE INTO `material` (`name`) VALUES ('Pana');
INSERT IGNORE INTO `material` (`name`) VALUES ('Papel');
INSERT IGNORE INTO `material` (`name`) VALUES ('Paperweb');
INSERT IGNORE INTO `material` (`name`) VALUES ('Paulownia');
INSERT IGNORE INTO `material` (`name`) VALUES ('Peluche');
INSERT IGNORE INTO `material` (`name`) VALUES ('Piedra');
INSERT IGNORE INTO `material` (`name`) VALUES ('Pizarra');
INSERT IGNORE INTO `material` (`name`) VALUES ('Plástico');
INSERT IGNORE INTO `material` (`name`) VALUES ('Poliestireno');
INSERT IGNORE INTO `material` (`name`) VALUES ('Polipropileno');
INSERT IGNORE INTO `material` (`name`) VALUES ('Poliresina');
INSERT IGNORE INTO `material` (`name`) VALUES ('Polyester');
INSERT IGNORE INTO `material` (`name`) VALUES ('Porcelana');
INSERT IGNORE INTO `material` (`name`) VALUES ('Puntilla');
INSERT IGNORE INTO `material` (`name`) VALUES ('PVC');
INSERT IGNORE INTO `material` (`name`) VALUES ('Rafia');
INSERT IGNORE INTO `material` (`name`) VALUES ('Rama');
INSERT IGNORE INTO `material` (`name`) VALUES ('Raso');
INSERT IGNORE INTO `material` (`name`) VALUES ('Rattan');
INSERT IGNORE INTO `material` (`name`) VALUES ('Rayon');
INSERT IGNORE INTO `material` (`name`) VALUES ('Reciclable');
INSERT IGNORE INTO `material` (`name`) VALUES ('Red');
INSERT IGNORE INTO `material` (`name`) VALUES ('Resina');
INSERT IGNORE INTO `material` (`name`) VALUES ('Roca');
INSERT IGNORE INTO `material` (`name`) VALUES ('Rope');
INSERT IGNORE INTO `material` (`name`) VALUES ('Saco');
INSERT IGNORE INTO `material` (`name`) VALUES ('Salim');
INSERT IGNORE INTO `material` (`name`) VALUES ('Seagrass');
INSERT IGNORE INTO `material` (`name`) VALUES ('Silicona');
INSERT IGNORE INTO `material` (`name`) VALUES ('Sisal');
INSERT IGNORE INTO `material` (`name`) VALUES ('Tejido');
INSERT IGNORE INTO `material` (`name`) VALUES ('Tela');
INSERT IGNORE INTO `material` (`name`) VALUES ('Terciopelo');
INSERT IGNORE INTO `material` (`name`) VALUES ('Terracota');
INSERT IGNORE INTO `material` (`name`) VALUES ('Textil');
INSERT IGNORE INTO `material` (`name`) VALUES ('Titanio');
INSERT IGNORE INTO `material` (`name`) VALUES ('Tul');
INSERT IGNORE INTO `material` (`name`) VALUES ('Velvet');
INSERT IGNORE INTO `material` (`name`) VALUES ('Vidrio');
INSERT IGNORE INTO `material` (`name`) VALUES ('Yute');
INSERT IGNORE INTO `material` (`name`) VALUES ('Zinc');
INSERT IGNORE INTO `material` (`name`) VALUES ('Base de goma');
INSERT IGNORE INTO `material` (`name`) VALUES ('Base de madera');
INSERT IGNORE INTO `material` (`name`) VALUES ('Plumas');
INSERT IGNORE INTO `material` (`name`) VALUES ('Protección Uva');
INSERT IGNORE INTO `material` (`name`) VALUES ('Purpurina');
UPDATE vn.tag SET isFree=0,sourceTable='material' WHERE name= 'Material';
UPDATE vn.tag SET isFree=0,sourceTable='material' WHERE name='Material secundario';

View File

@ -0,0 +1,4 @@
-- Place your SQL code here
INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId)
VALUES ('Worker', '__get__descriptor', 'READ', 'ALLOW', 'ROLE', 'employee'),
('Worker', 'findById', 'READ', 'ALLOW', 'ROLE', '$subordinate');

View File

@ -0,0 +1,12 @@
-- Place your SQL code here
DELETE FROM salix.ACL WHERE model = 'Province' LIMIT 1;
DELETE FROM salix.ACL WHERE model = 'Town' LIMIT 1;
UPDATE salix.ACL SET accessType = 'READ' WHERE model = 'BankEntity';
INSERT INTO salix.ACL
SET model = 'BankEntity',
property = '*',
accessType = 'WRITE',
permission = 'ALLOW',
principalType = 'ROLE',
principalId = 'financial';

View File

@ -0,0 +1,19 @@
INSERT INTO hedera.message (code,description)
VALUES ('ORDER_ROW_UNAVAILABLE','The ordered quantity exceeds the available');
INSERT INTO hedera.message (code,description)
VALUES ('AMOUNT_NOT_MATCH_GROUPING','The quantity ordered does not match the grouping');
INSERT INTO hedera.messageI18n (code,lang,description)
VALUES ('ORDER_ROW_UNAVAILABLE','es','La cantidad pedida excede el disponible');
INSERT INTO hedera.messageI18n (code,lang,description)
VALUES ('AMOUNT_NOT_MATCH_GROUPING','es','La cantidad pedida no coincide con el agrupado');
INSERT INTO hedera.messageI18n (code,lang,description)
VALUES ('ORDER_ROW_UNAVAILABLE','fr','La quantité demandée dépasse ce qui est disponible');
INSERT INTO hedera.messageI18n (code,lang,description)
VALUES ('AMOUNT_NOT_MATCH_GROUPING','fr','La quantité commandée ne correspond pas au regroupement');
INSERT INTO hedera.messageI18n (code,lang,description)
VALUES ('ORDER_ROW_UNAVAILABLE','pt','A quantidade de entrega excede a disponibilidade');
INSERT INTO hedera.messageI18n (code,lang,description)
VALUES ('AMOUNT_NOT_MATCH_GROUPING','pt','A quantidade solicitada não corresponde ao agrupamento');

View File

@ -0,0 +1 @@
CREATE INDEX saleGroupLog_creationDate_IDX USING BTREE ON vn.saleGroupLog (creationDate DESC);

View File

@ -0,0 +1,9 @@
-- Place your SQL code here
CREATE TABLE IF NOT EXISTS vn.ticketCanAdvanceConfig (
id int(10) unsigned NOT NULL,
destinationOrder INT NULL,
PRIMARY KEY (`id`),
CONSTRAINT `ticketCanAdvanceConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
INSERT INTO vn.ticketCanAdvanceConfig SET id =1, destinationOrder = 5;

View File

@ -0,0 +1 @@
ALTER TABLE vn.state DROP COLUMN sectorProdPriority;

View File

@ -0,0 +1,2 @@
INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId)
VALUES( 'Device', 'handleUser', '*', 'ALLOW', 'ROLE', 'employee');

View File

@ -0,0 +1,3 @@
ALTER TABLE vn.creditInsurance DROP FOREIGN KEY CreditInsurance_Fk1;
ALTER TABLE vn.creditInsurance
CHANGE creditClassification creditClassification__ int(11) DEFAULT NULL COMMENT '@deprecated 2024-09-11';

View File

@ -0,0 +1 @@
ALTER TABLE vn.workerDocument CHANGE worker workerFk int(10) unsigned DEFAULT NULL NULL;

View File

@ -0,0 +1 @@
ALTER TABLE vn.workerDocument CHANGE document dmsFk int(11) DEFAULT NULL NULL;

View File

@ -0,0 +1 @@
RENAME TABLE vn.workerDocument TO vn.workerDms;

View File

@ -0,0 +1,3 @@
-- Place your SQL code here
ALTER TABLE vn.productionConfig ADD minPlantTrayLength INT DEFAULT 53 NOT NULL
COMMENT 'minimum length for plant tray restriction. Avoid to make collection of the ticket with this kind of item';

View File

@ -687,8 +687,8 @@ export default {
ticketFuture: {
searchResult: 'vn-ticket-future tbody tr',
openAdvancedSearchButton: 'vn-searchbar .append vn-icon[icon="arrow_drop_down"]',
originDated: 'vn-date-picker[label="Origin date"]',
futureDated: 'vn-date-picker[label="Destination date"]',
originScopeDays: 'vn-date-picker[label="Origin date"]',
futureScopeDays: 'vn-date-picker[label="Destination date"]',
linesMax: 'vn-textfield[label="Max Lines"]',
litersMax: 'vn-textfield[label="Max Liters"]',
ipt: 'vn-autocomplete[label="Origin IPT"]',

View File

@ -35,6 +35,14 @@ describe('Client Edit billing data path', () => {
it(`should attempt to edit the billing data without an IBAN but fail`, async() => {
await page.autocompleteSearch($.payMethod, 'PayMethod with IBAN');
await page.waitToClick($.saveButton);
const message = await page.waitForSnackbar();
expect(message.text).toContain('That payment method requires an IBAN');
});
it(`should edit the billing data and save the form`, async() => {
await page.autocompleteSearch($.payMethod, 'PayMethod five');
await page.autocompleteSearch($.swiftBic, 'BBKKESMMMMM');
await page.clearInput($.dueDay);
await page.write($.dueDay, '60');
@ -45,10 +53,13 @@ describe('Client Edit billing data path', () => {
await page.waitToClick($.saveButton);
const message = await page.waitForSnackbar();
expect(message.text).toContain('That payment method requires an IBAN');
expect(message.text).toContain('Notification sent!');
});
it(`should create a new BIC code`, async() => {
await page.loginAndModule('financial', 'client');
await page.accessToSearchResult('Bruce Banner');
await page.accessToSection('client.card.billingData');
await page.waitToClick($.newBankEntityButton);
await page.write($.newBankEntityName, 'Gotham City Bank');
await page.write($.newBankEntityBIC, 'GTHMCT');
@ -66,7 +77,7 @@ describe('Client Edit billing data path', () => {
it(`should confirm the IBAN pay method was sucessfully saved`, async() => {
const payMethod = await page.waitToGetProperty($.payMethod, 'value');
expect(payMethod).toEqual('PayMethod with IBAN');
expect(payMethod).toEqual('PayMethod five');
});
it(`should clear the BIC code field, update the IBAN to see how he BIC code autocompletes`, async() => {
@ -79,14 +90,6 @@ describe('Client Edit billing data path', () => {
expect(automaticCode).toEqual('CAIXESBB');
});
it(`should save the form with all its new data`, async() => {
await page.waitForWatcherData($.watcher);
await page.waitToClick($.saveButton);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Notification sent!');
});
it('should confirm the billing data have been edited', async() => {
const dueDate = await page.waitToGetProperty($.dueDay, 'value');
const IBAN = await page.waitToGetProperty($.IBAN, 'value');
@ -94,7 +97,9 @@ describe('Client Edit billing data path', () => {
const receivedCoreLCR = await page.checkboxState($.receivedCoreLCRCheckbox);
const receivedCoreVNL = await page.checkboxState($.receivedCoreVNLCheckbox);
const receivedB2BVNL = await page.checkboxState($.receivedB2BVNLCheckbox);
const payMethod = await page.waitToGetProperty($.payMethod, 'value');
expect(payMethod).toEqual('PayMethod five');
expect(dueDate).toEqual('60');
expect(IBAN).toEqual('ES9121000418450200051332');
expect(swiftBic).toEqual('CAIXESBB');

View File

@ -30,18 +30,18 @@ describe('Ticket Future path', () => {
expect(message.text).toContain('warehouseFk is a required argument');
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
await page.clearInput(selectors.ticketFuture.futureDated);
await page.clearInput(selectors.ticketFuture.futureScopeDays);
await page.waitToClick(selectors.ticketFuture.submit);
message = await page.waitForSnackbar();
expect(message.text).toContain('futureDated is a required argument');
expect(message.text).toContain('futureScopeDays is a required argument');
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
await page.clearInput(selectors.ticketFuture.originDated);
await page.clearInput(selectors.ticketFuture.originScopeDays);
await page.waitToClick(selectors.ticketFuture.submit);
message = await page.waitForSnackbar();
expect(message.text).toContain('originDated is a required argument');
expect(message.text).toContain('originScopeDays is a required argument');
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
await page.waitToClick(selectors.ticketFuture.submit);
@ -71,7 +71,7 @@ describe('Ticket Future path', () => {
await page.autocompleteSearch(selectors.ticketFuture.state, 'Free');
await page.waitToClick(selectors.ticketFuture.submit);
expect(httpRequest).toContain('state=FREE');
expect(httpRequest).toContain('state=0');
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
@ -80,7 +80,7 @@ describe('Ticket Future path', () => {
await page.autocompleteSearch(selectors.ticketFuture.futureState, 'Free');
await page.waitToClick(selectors.ticketFuture.submit);
expect(httpRequest).toContain('futureState=FREE');
expect(httpRequest).toContain('futureState=0');
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
await page.clearInput(selectors.ticketFuture.state);

View File

@ -1,79 +0,0 @@
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
describe('Supplier summary & descriptor path', () => {
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('administrative', 'supplier');
await page.accessToSearchResult('1');
});
afterAll(async() => {
await browser.close();
});
// summary
it('should reach the second entry summary section', async() => {
await page.waitForState('supplier.card.summary');
});
it(`should confirm there's data on the summary header`, async() => {
const result = await page.waitToGetProperty(selectors.supplierSummary.header, 'innerText');
expect(result).toContain('PLANTS SL - 1');
});
it(`should confirm there's data on the summary basic data`, async() => {
const result = await page.waitToGetProperty(selectors.supplierSummary.basicDataId, 'innerText');
expect(result).toContain('Id 1');
});
it(`should confirm there's data on the summary fiscal address`, async() => {
const result = await page.waitToGetProperty(selectors.supplierSummary.fiscalAddressTaxNumber, 'innerText');
expect(result).toContain('Tax number 06089160W');
});
it(`should confirm there's data on the summary fiscal pay method`, async() => {
const result = await page.waitToGetProperty(selectors.supplierSummary.billingDataPayMethod, 'innerText');
expect(result).toContain('Pay method PayMethod one');
});
// descriptor
it(`should confirm there's data on the descriptor`, async() => {
const result = await page.waitToGetProperty(selectors.supplierDescriptor.alias, 'innerText');
expect(result).toContain('Plants nick');
});
it(`should navigate to the supplier's client summary using the icon client button`, async() => {
await page.waitToClick(selectors.supplierDescriptor.clientButton);
await page.waitForState('client.card.summary');
});
it(`should navigate back to the supplier`, async() => {
await page.waitToClick(selectors.globalItems.homeButton);
await page.waitForState('home');
await page.selectModule('supplier');
await page.accessToSearchResult('1');
await page.waitForState('supplier.card.summary');
});
it(`should navigate back to suppliers but a different one this time`, async() => {
await page.waitToClick(selectors.globalItems.homeButton);
await page.waitForState('home');
await page.selectModule('supplier');
await page.accessToSearchResult('2');
await page.waitForState('supplier.card.summary');
});
it(`should check the client button isn't present since this supplier should not be a client`, async() => {
await page.waitForSelector(selectors.supplierDescriptor.clientButton, {visible: false});
});
});

View File

@ -1,67 +0,0 @@
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
describe('Supplier basic data path', () => {
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('financial', 'supplier');
await page.accessToSearchResult('1');
await page.accessToSection('supplier.card.basicData');
});
afterAll(async() => {
await browser.close();
});
it('should edit the basic data', async() => {
await page.clearInput(selectors.supplierBasicData.alias);
await page.write(selectors.supplierBasicData.alias, 'Plants Nick SL');
await page.waitToClick(selectors.supplierBasicData.isReal);
await page.waitToClick(selectors.supplierBasicData.isActive);
await page.waitToClick(selectors.supplierBasicData.isPayMethodChecked);
await page.write(selectors.supplierBasicData.notes, 'Some notes');
await page.waitToClick(selectors.supplierBasicData.saveButton);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
it('should reload the section', async() => {
await page.reloadSection('supplier.card.basicData');
});
it('should check the alias was edited', async() => {
const result = await page.waitToGetProperty(selectors.supplierBasicData.alias, 'value');
expect(result).toEqual('Plants Nick SL');
});
it('should check the isReal checkbox is now checked', async() => {
const result = await page.checkboxState(selectors.supplierBasicData.isReal);
expect(result).toBe('checked');
});
it('should check the isActive checkbox is now unchecked', async() => {
const result = await page.checkboxState(selectors.supplierBasicData.isActive);
expect(result).toBe('unchecked');
});
it('should check the isPayMethodChecked checkbox is now unchecked', async() => {
const result = await page.checkboxState(selectors.supplierBasicData.isPayMethodChecked);
expect(result).toBe('unchecked');
});
it('should check the notes were edited', async() => {
const result = await page.waitToGetProperty(selectors.supplierBasicData.notes, 'value');
expect(result).toEqual('Some notes');
});
});

View File

@ -1,56 +0,0 @@
import getBrowser from '../../helpers/puppeteer';
describe('Supplier fiscal data path', () => {
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('administrative', 'supplier');
await page.accessToSearchResult('2');
});
afterAll(async() => {
await browser.close();
});
it('should attempt to edit the fiscal data and check data iss saved', async() => {
await page.accessToSection('supplier.card.fiscalData');
const form = 'vn-supplier-fiscal-data form';
const values = {
province: null,
country: null,
postcode: null,
city: 'Valencia',
socialName: 'FARMER KING SL',
taxNumber: '12345678Z',
account: '0123456789',
sageWithholding: 'retencion estimacion objetiva',
sageTaxType: 'operaciones no sujetas'
};
const errorMessage = await page.sendForm(form, {
taxNumber: 'Wrong tax number'
});
const message = await page.sendForm(form, values);
await page.reloadSection('supplier.card.fiscalData');
const formValues = await page.fetchForm(form, Object.keys(values));
expect(errorMessage.text).toContain('Invalid Tax number');
expect(message.isSuccess).toBeTrue();
expect(formValues).toEqual({
province: 'Province one',
country: 'España',
postcode: '46000',
city: 'Valencia',
socialName: 'FARMER KING SL',
taxNumber: '12345678Z',
account: '0123456789',
sageWithholding: 'RETENCION ESTIMACION OBJETIVA',
sageTaxType: 'Operaciones no sujetas'
});
});
});

View File

@ -1,52 +0,0 @@
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
describe('Supplier billing data path', () => {
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('administrative', 'supplier');
await page.accessToSearchResult('442');
await page.accessToSection('supplier.card.billingData');
});
afterAll(async() => {
await browser.close();
});
it('should edit the billing data', async() => {
await page.autocompleteSearch(selectors.supplierBillingData.payMethod, 'PayMethod with IBAN');
await page.autocompleteSearch(selectors.supplierBillingData.payDem, '10');
await page.clearInput(selectors.supplierBillingData.payDay);
await page.write(selectors.supplierBillingData.payDay, '19');
await page.waitToClick(selectors.supplierBillingData.saveButton);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
it('should reload the section', async() => {
await page.reloadSection('supplier.card.billingData');
});
it('should check the pay method was edited', async() => {
const result = await page.waitToGetProperty(selectors.supplierBillingData.payMethod, 'value');
expect(result).toEqual('PayMethod with IBAN');
});
it('should check the payDem was edited', async() => {
const result = await page.waitToGetProperty(selectors.supplierBillingData.payDem, 'value');
expect(result).toEqual('10');
});
it('should check the pay day was edited', async() => {
const result = await page.waitToGetProperty(selectors.supplierBillingData.payDay, 'value');
expect(result).toEqual('19');
});
});

View File

@ -1,79 +0,0 @@
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
describe('Supplier address path', () => {
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('employee', 'supplier');
await page.accessToSearchResult('1');
await page.accessToSection('supplier.card.address.index');
});
afterAll(async() => {
await browser.close();
});
it('should count the addresses before creating one', async() => {
const count = await page.countElement(selectors.supplierAddress.anyAddress);
expect(count).toEqual(2);
});
it('should open the new address form by clicking the add button', async() => {
await page.waitToClick(selectors.supplierAddress.newAddress);
await page.waitForState('supplier.card.address.create');
});
it('should create a new address', async() => {
await page.write(selectors.supplierAddress.newNickname, 'Darkest dungeon');
await page.write(selectors.supplierAddress.newStreet, 'Wayne manor');
await page.write(selectors.supplierAddress.newPostcode, '46000');
await page.write(selectors.supplierAddress.newCity, 'Valencia');
await page.autocompleteSearch(selectors.supplierAddress.newProvince, 'Province one');
await page.write(selectors.supplierAddress.newPhone, '888888888');
await page.write(selectors.supplierAddress.newMobile, '444444444');
await page.waitToClick(selectors.supplierAddress.saveButton);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
it('should have been redirected to the addresses index', async() => {
await page.waitForState('supplier.card.address.index');
});
it('should count the addresses and find one more now', async() => {
const count = await page.countElement(selectors.supplierAddress.anyAddress);
expect(count).toEqual(3);
});
it('should open the edit address form by clicking the new address', async() => {
await page.waitToClick(selectors.supplierAddress.thirdAddress);
await page.waitForState('supplier.card.address.edit');
});
it('should edit the address', async() => {
await page.overwrite(selectors.supplierAddress.editNickname, 'Wayne manor');
await page.overwrite(selectors.supplierAddress.editStreet, '1007 Mountain Drive');
await page.overwrite(selectors.supplierAddress.editPostcode, '46000');
await page.overwrite(selectors.supplierAddress.editCity, 'Valencia');
await page.autocompleteSearch(selectors.supplierAddress.editProvince, 'Province one');
await page.overwrite(selectors.supplierAddress.editPhone, '777777777');
await page.overwrite(selectors.supplierAddress.editMobile, '555555555');
await page.waitToClick(selectors.supplierAddress.saveButton);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
it('should check the address has now the expected data', async() => {
let thirdAddress = await page.waitToGetProperty(selectors.supplierAddress.thirdAddress, 'innerText');
expect(thirdAddress).toContain('Wayne manor');
});
});

View File

@ -1,89 +0,0 @@
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
describe('Supplier contact path', () => {
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('administrative', 'supplier');
await page.accessToSearchResult('1');
await page.accessToSection('supplier.card.contact');
});
afterAll(async() => {
await browser.close();
});
it('should create a new contact', async() => {
await page.waitToClick(selectors.supplierContact.addNewContact);
await page.write(selectors.supplierContact.thirdContactName, 'The tester');
await page.write(selectors.supplierContact.thirdContactPhone, '99 999 99 99');
await page.write(selectors.supplierContact.thirdContactMobile, '555 55 55 55');
await page.write(selectors.supplierContact.thirdContactEmail, 'testing@puppeteer.com');
await page.write(selectors.supplierContact.thirdContactNotes, 'the end to end integration tester');
await page.waitToClick(selectors.supplierContact.saveButton);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
it(`should reload the section and count the contacts`, async() => {
await page.reloadSection('supplier.card.contact');
const result = await page.countElement(selectors.supplierContact.anyContact);
expect(result).toEqual(3);
});
it(`should check the new contact name was saved correctly`, async() => {
const result = await page.waitToGetProperty(selectors.supplierContact.thirdContactName, 'value');
expect(result).toContain('The tester');
});
it(`should check the new contact phone was saved correctly`, async() => {
const result = await page.waitToGetProperty(selectors.supplierContact.thirdContactPhone, 'value');
expect(result).toContain('99 999 99 99');
});
it(`should check the new contact mobile was saved correctly`, async() => {
const result = await page.waitToGetProperty(selectors.supplierContact.thirdContactMobile, 'value');
expect(result).toContain('555 55 55 55');
});
it(`should check the new contact email was saved correctly`, async() => {
const result = await page.waitToGetProperty(selectors.supplierContact.thirdContactEmail, 'value');
expect(result).toContain('testing@puppeteer.com');
});
it(`should check the new contact note was saved correctly`, async() => {
await page.waitForTextInField(selectors.supplierContact.thirdContactNotes, 'the end to end integration tester');
const result = await page.waitToGetProperty(selectors.supplierContact.thirdContactNotes, 'value');
expect(result).toContain('the end to end integration tester');
});
it(`should remove the created contact`, async() => {
await page.waitToClick(selectors.supplierContact.thirdContactDeleteButton, 'value');
const result = await page.countElement(selectors.supplierContact.anyContact);
expect(result).toEqual(2);
await page.waitToClick(selectors.supplierContact.saveButton);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
it(`should reload the section and count the amount of contacts went back to 2`, async() => {
await page.reloadSection('supplier.card.contact');
const result = await page.countElement(selectors.supplierContact.anyContact);
expect(result).toEqual(2);
});
});

View File

@ -33,7 +33,7 @@ module.exports = function(Self) {
const defaultLimit = this.app.orm.selectLimit;
const filter = ctx.args.filter || {limit: defaultLimit};
if (filter.limit > defaultLimit) {
if (!filter.limit || filter.limit > defaultLimit) {
filter.limit = defaultLimit;
ctx.args.filter = filter;
}
@ -349,9 +349,10 @@ module.exports = function(Self) {
},
hasFilter(ctx) {
return ctx.req.method.toUpperCase() === 'GET' &&
ctx.method.accepts.some(x => x.arg === 'filter' && x.type.toLowerCase() === 'object');
}
const {method, req} = ctx;
if (method.noLimit) return false;
return req.method.toUpperCase() === 'GET' &&
method.accepts.some(x => x.arg === 'filter' && x.type.toLowerCase() === 'object');
},
});
};

View File

@ -236,6 +236,8 @@
"Cannot send mail": "Cannot send mail",
"CONSTRAINT `chkParkingCodeFormat` failed for `vn`.`parking`": "CONSTRAINT `chkParkingCodeFormat` failed for `vn`.`parking`",
"This postcode already exists": "This postcode already exists",
"Original invoice not found": "Original invoice not found"
"Original invoice not found": "Original invoice not found",
"There is already a tray with the same height": "There is already a tray with the same height",
"The height must be greater than 50cm": "The height must be greater than 50cm",
"The maximum height of the wagon is 200cm": "The maximum height of the wagon is 200cm"
}

View File

@ -371,5 +371,11 @@
"The sale not exists in the item shelving": "La venta no existe en la estantería del artículo",
"The entry not have stickers": "La entrada no tiene etiquetas",
"Too many records": "Demasiados registros",
"Original invoice not found": "Factura original no encontrada"
"Original invoice not found": "Factura original no encontrada",
"The entry has no lines or does not exist": "La entrada no tiene lineas o no existe",
"Weight already set": "El peso ya está establecido",
"This ticket is not allocated to your department": "Este ticket no está asignado a tu departamento",
"There is already a tray with the same height": "Ya existe una bandeja con la misma altura",
"The height must be greater than 50cm": "La altura debe ser superior a 50cm",
"The maximum height of the wagon is 200cm": "La altura máxima es 200cm"
}

View File

@ -0,0 +1,12 @@
const UserError = require('vn-loopback/util/user-error');
module.exports = async function(app) {
const models = app.models;
models.VnRole.registerResolver('$subordinate', async(role, ctx) => {
Object.assign(ctx, {req: {accessToken: {userId: ctx.accessToken.userId}}});
const isSubordinate = await models.Worker.isSubordinate(ctx, +ctx.modelId);
if (!isSubordinate) throw new UserError(`You don't have enough privileges`);
});
};

Some files were not shown because too many files have changed in this diff Show More