Exported db
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
92db67292c
commit
49fbecfc59
|
@ -1233,11 +1233,18 @@ INSERT INTO `vn`.`annualAverageInvoiced`(`clientFk`, `invoiced`)
|
|||
(104, 500),
|
||||
(105, 5000);
|
||||
|
||||
INSERT INTO `vn`.`supplier`(`id`, `name`, `nickname`,`account`,`countryFk`,`nif`,`isFarmer`,`commission`, `created`, `isActive`, `street`, `city`, `provinceFk`, `postCode`, `payMethodFk`, `payDemFk`, `payDay`, `taxTypeSageFk`, `withholdingSageFk`, `transactionTypeSageFk`, `workerFk`)
|
||||
INSERT INTO `vn`.`supplierActivity`(`code`, `name`)
|
||||
VALUES
|
||||
(1, 'Plants SL', 'Plants nick', 4100000001, 1, '06089160W', 0, 0, CURDATE(), 1, 'supplier address 1', 'PONTEVEDRA', 1, 15214, 1, 1, 15, 4, 1, 1, 18),
|
||||
(2, 'Farmer King', 'The farmer', 4000020002, 1, '87945234L', 1, 0, CURDATE(), 1, 'supplier address 2', 'SILLA', 2, 43022, 1, 2, 10, 93, 2, 8, 18),
|
||||
(442, 'Verdnatura Levante SL', 'Verdnatura', 5115000442, 1, '06815934E', 0, 0, CURDATE(), 1, 'supplier address 3', 'SILLA', 1, 43022, 1, 2, 15, 6, 9, 3, 18);
|
||||
('animals', 'Food and complements for pets'),
|
||||
('complements', 'Other complements'),
|
||||
('flowerPlants', 'Wholesale of flowers and plants'),
|
||||
('vegetablesFruits', 'Fruit and vegetable trade');
|
||||
|
||||
INSERT INTO `vn`.`supplier`(`id`, `name`, `nickname`,`account`,`countryFk`,`nif`,`isFarmer`,`commission`, `created`, `isActive`, `street`, `city`, `provinceFk`, `postCode`, `payMethodFk`, `payDemFk`, `payDay`, `taxTypeSageFk`, `withholdingSageFk`, `transactionTypeSageFk`, `workerFk`, `supplierActivityFk`)
|
||||
VALUES
|
||||
(1, 'Plants SL', 'Plants nick', 4100000001, 1, '06089160W', 0, 0, CURDATE(), 1, 'supplier address 1', 'PONTEVEDRA', 1, 15214, 1, 1, 15, 4, 1, 1, 18, 'flowerPlants'),
|
||||
(2, 'Farmer King', 'The farmer', 4000020002, 1, '87945234L', 1, 0, CURDATE(), 1, 'supplier address 2', 'SILLA', 2, 43022, 1, 2, 10, 93, 2, 8, 18, 'animals'),
|
||||
(442, 'Verdnatura Levante SL', 'Verdnatura', 5115000442, 1, '06815934E', 0, 0, CURDATE(), 1, 'supplier address 3', 'SILLA', 1, 43022, 1, 2, 15, 6, 9, 3, 18, 'flowerPlants');
|
||||
|
||||
INSERT INTO `vn`.`supplierContact`(`id`, `supplierFk`, `phone`, `mobile`, `email`, `observation`, `name`)
|
||||
VALUES
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
-- MariaDB dump 10.18 Distrib 10.5.8-MariaDB, for Linux (x86_64)
|
||||
-- MariaDB dump 10.19 Distrib 10.5.9-MariaDB, for Linux (x86_64)
|
||||
--
|
||||
-- Host: test-db.verdnatura.es Database: account
|
||||
-- ------------------------------------------------------
|
||||
|
@ -8861,9 +8861,13 @@ DROP TABLE IF EXISTS `genus`;
|
|||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `genus` (
|
||||
`id` mediumint(8) unsigned NOT NULL,
|
||||
`name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
`genus_id` mediumint(8) unsigned NOT NULL,
|
||||
`latin_genus_name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
|
||||
`entry_date` date DEFAULT NULL,
|
||||
`expiry_date` date DEFAULT NULL,
|
||||
`change_date_time` datetime DEFAULT NULL,
|
||||
`isHazard` tinyint(1) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`genus_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='/tmp/floricode/florecompc2/FG130916.txt';
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
|
@ -9163,7 +9167,7 @@ DROP TABLE IF EXISTS `plant`;
|
|||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `plant` (
|
||||
`plant_id` mediumint(8) unsigned NOT NULL,
|
||||
`id` mediumint(8) unsigned NOT NULL,
|
||||
`genus_id` mediumint(8) unsigned NOT NULL,
|
||||
`specie_id` mediumint(8) unsigned DEFAULT NULL,
|
||||
`entry_date` date DEFAULT NULL,
|
||||
`expiry_date` date DEFAULT NULL,
|
||||
|
@ -9239,6 +9243,7 @@ BEGIN
|
|||
DECLARE vError VARCHAR(100) DEFAULT 'Orderregel niet meer teruggevonden op basis van de orderps';
|
||||
DECLARE vVmpIdError INT DEFAULT 7;
|
||||
DECLARE vVmpFk INT;
|
||||
DECLARE vSupplyResponseNumberOfUnits INT;
|
||||
|
||||
SELECT sr.vmpID INTO vVmpFk
|
||||
FROM edi.supplyResponse sr
|
||||
|
@ -9254,6 +9259,17 @@ BEGIN
|
|||
SET NEW.OrderStatus = 2;
|
||||
|
||||
END IF;
|
||||
|
||||
-- Error de disponible menor de lo solicitado
|
||||
IF NEW.error LIKE 'error2602%' THEN
|
||||
|
||||
SELECT NumberOfUnits INTO vSupplyResponseNumberOfUnits
|
||||
FROM edi.supplyResponse sr
|
||||
WHERE sr.ID = NEW.supplyResponseID;
|
||||
|
||||
SET NEW.error = CONCAT('(',vSupplyResponseNumberOfUnits,') ', NEW.error);
|
||||
|
||||
END IF;
|
||||
END */;;
|
||||
DELIMITER ;
|
||||
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
||||
|
@ -9354,7 +9370,7 @@ DROP TABLE IF EXISTS `specie`;
|
|||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `specie` (
|
||||
`specie_id` mediumint(8) unsigned NOT NULL,
|
||||
`id` mediumint(8) unsigned NOT NULL,
|
||||
`genus_id` mediumint(8) unsigned NOT NULL,
|
||||
`latin_species_name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
|
||||
`entry_date` date DEFAULT NULL,
|
||||
`expiry_date` date DEFAULT NULL,
|
||||
|
@ -10059,9 +10075,9 @@ DELIMITER ;
|
|||
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
|
||||
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
|
||||
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
|
||||
/*!50003 SET character_set_client = utf8mb4 */ ;
|
||||
/*!50003 SET character_set_results = utf8mb4 */ ;
|
||||
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
|
||||
/*!50003 SET character_set_client = utf8 */ ;
|
||||
/*!50003 SET character_set_results = utf8 */ ;
|
||||
/*!50003 SET collation_connection = utf8_general_ci */ ;
|
||||
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
|
||||
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
|
||||
DELIMITER ;;
|
||||
|
@ -10076,6 +10092,7 @@ proc: BEGIN
|
|||
DECLARE vIsAuctionDay BOOLEAN;
|
||||
DECLARE vMaxNewItems INT DEFAULT 100000;
|
||||
DECLARE vStartingTime DATETIME;
|
||||
DECLARE vAalsmeerMarketPlaceID VARCHAR(13) DEFAULT '8713783439043';
|
||||
|
||||
DECLARE cur1 CURSOR FOR
|
||||
SELECT id
|
||||
|
@ -10119,10 +10136,11 @@ proc: BEGIN
|
|||
FROM (
|
||||
SELECT *
|
||||
FROM edi.supplyOffer
|
||||
ORDER BY NumberOfUnits DESC) t
|
||||
ORDER BY (MarketPlaceID = vAalsmeerMarketPlaceID) DESC, NumberOfUnits DESC) t
|
||||
JOIN edi.item_groupToOffer igo ON igo.group_code = t.group_id
|
||||
LEFT JOIN edi.item_defaultType idt ON idt.item_id = t.Item_ArticleCode
|
||||
GROUP BY Item_ArticleCode, s1, s2, s3, s4, s5, s6, company_name, Quality, NumberOfItemsPerCask, EmbalageCode, Price ;
|
||||
GROUP BY Item_ArticleCode, s1, s2, s3, s4, s5, s6, company_name, Quality, NumberOfItemsPerCask, EmbalageCode, Price
|
||||
;
|
||||
|
||||
-- -- select now(),'Antes de crear edi.offer';
|
||||
DROP TEMPORARY TABLE IF EXISTS edi.offer;
|
||||
|
@ -10364,6 +10382,423 @@ proc: BEGIN
|
|||
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.agencyFk
|
||||
JOIN vn.item i ON i.id = b.itemFk
|
||||
JOIN edi.supplyResponse sr ON i.supplyResponseFk = sr.ID
|
||||
LEFT JOIN edi.putOrder po ON b.deliveryFk = po.deliveryInformationID
|
||||
LEFT JOIN edi.deliveryInformation di ON di.ID = b.deliveryFk
|
||||
SET b.quantity = 0
|
||||
WHERE (di.LatestOrderDateTime < NOW()
|
||||
OR sr.ID 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.floramondo_getEntry(TIMESTAMPADD(DAY,travellingDays,vLanded), 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);
|
||||
|
||||
-- Se eliminan las ofertas ya incluidas en las entradas
|
||||
DELETE o
|
||||
FROM edi.offer o
|
||||
JOIN vn.item i ON i.supplyResponseFk = o.srId
|
||||
JOIN vn.buy b ON i.id = b.itemFk
|
||||
JOIN edi.warehouseFloramondo wf ON wf.entryFk = b.entryFk;
|
||||
|
||||
-- Se inserta el resto
|
||||
SET vLastInserted := NOW();
|
||||
|
||||
-- Inserta la oferta
|
||||
INSERT INTO vn.buy(entryFk,
|
||||
itemFk,
|
||||
quantity,
|
||||
buyingValue,
|
||||
stickers,
|
||||
packing,
|
||||
`grouping`,
|
||||
groupingMode,
|
||||
packageFk,
|
||||
deliveryFk)
|
||||
|
||||
SELECT wf.entryFk,
|
||||
i.id,
|
||||
o.NumberOfUnits * o.NumberOfItemsPerCask as quantity,
|
||||
o.Price,
|
||||
o.NumberOfUnits as etiquetas,
|
||||
o.NumberOfItemsPerCask as packing,
|
||||
GREATEST(1, IFNULL(o.MinimumQuantity,0)) * o.NumberOfItemsPerCask as `grouping`,
|
||||
2, -- Obliga al Packing
|
||||
o.embalageCode,
|
||||
o.diId
|
||||
FROM edi.offer o
|
||||
JOIN vn.item i ON i.supplyResponseFk = o.srId
|
||||
JOIN vn.itemType it ON it.id = i.typeFk
|
||||
JOIN edi.warehouseFloramondo wf ON wf.isFV = it.isFV OR wf.isFV IS NULL
|
||||
JOIN vn.packaging p ON p.id LIKE o.embalageCode; -- llevar esta linea i mirar de crear els packages a temps real
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.buyRecalc;
|
||||
|
||||
CREATE TEMPORARY TABLE tmp.buyRecalc
|
||||
SELECT b.id
|
||||
FROM vn.buy b
|
||||
JOIN edi.warehouseFloramondo wf ON wf.entryFk = b.entryFk
|
||||
WHERE b.created >= vLastInserted;
|
||||
|
||||
CALL vn.buy_recalcPrices();
|
||||
|
||||
END IF;
|
||||
|
||||
DROP TEMPORARY TABLE
|
||||
edi.offer,
|
||||
itemToInsert;
|
||||
|
||||
DROP TABLE tmp.item;
|
||||
|
||||
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;
|
||||
|
||||
INSERT INTO edi.log(tableName, fieldName,fieldValue)
|
||||
VALUES('floramondo_offerRefresh','Tiempo de proceso',TIMEDIFF(NOW(),vStartingTime));
|
||||
|
||||
|
||||
|
||||
END ;;
|
||||
DELIMITER ;
|
||||
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
||||
/*!50003 SET character_set_client = @saved_cs_client */ ;
|
||||
/*!50003 SET character_set_results = @saved_cs_results */ ;
|
||||
/*!50003 SET collation_connection = @saved_col_connection */ ;
|
||||
/*!50003 DROP PROCEDURE IF EXISTS `floramondo_offerRefresh__` */;
|
||||
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
|
||||
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
|
||||
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
|
||||
/*!50003 SET character_set_client = utf8 */ ;
|
||||
/*!50003 SET character_set_results = utf8 */ ;
|
||||
/*!50003 SET collation_connection = utf8_general_ci */ ;
|
||||
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
|
||||
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
|
||||
DELIMITER ;;
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE `floramondo_offerRefresh__`()
|
||||
proc: BEGIN
|
||||
|
||||
DECLARE vLanded DATETIME;
|
||||
DECLARE done INT DEFAULT FALSE;
|
||||
DECLARE vFreeId INT;
|
||||
DECLARE vSupplyResponseFk INT;
|
||||
DECLARE vLastInserted DATETIME;
|
||||
DECLARE vIsAuctionDay BOOLEAN;
|
||||
DECLARE vMaxNewItems INT DEFAULT 100000;
|
||||
DECLARE vStartingTime DATETIME;
|
||||
|
||||
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 done = TRUE;
|
||||
DECLARE EXIT HANDLER FOR SQLSTATE '45000'
|
||||
BEGIN
|
||||
ROLLBACK;
|
||||
RESIGNAL;
|
||||
END;
|
||||
|
||||
SET vStartingTime = NOW();
|
||||
|
||||
-- CALL vn.clean_logiflora();
|
||||
|
||||
-- Refresca las fotos de los items existentes, con prioridad baja (0.7 seg)
|
||||
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
|
||||
WHERE i.image != edi.imageName(sr.PictureReference)
|
||||
AND sr.NumberOfUnits > 0;
|
||||
|
||||
DELETE itf.*
|
||||
FROM edi.item_free itf
|
||||
JOIN vn.item i ON i.id = itf.id;
|
||||
|
||||
-- -- select now(),'Tras borrar';
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp;
|
||||
CREATE TEMPORARY TABLE tmp (INDEX (`Item_ArticleCode`)) ENGINE = MEMORY
|
||||
SELECT t.*,
|
||||
IFNULL(idt.itemTypeFk, igo.itemTypeFk) itemTypeFk,
|
||||
igo.expenseFk ,
|
||||
igo.intrastatFk ,
|
||||
igo.originFk
|
||||
FROM (
|
||||
SELECT *
|
||||
FROM edi.supplyOffer
|
||||
ORDER BY NumberOfUnits DESC) t
|
||||
JOIN edi.item_groupToOffer igo ON igo.group_code = t.group_id
|
||||
LEFT JOIN edi.item_defaultType idt ON idt.item_id = t.Item_ArticleCode
|
||||
GROUP BY Item_ArticleCode, s1, s2, s3, s4, s5, s6, company_name, Quality, NumberOfItemsPerCask, EmbalageCode, Price ;
|
||||
|
||||
-- -- select now(),'Antes de crear edi.offer';
|
||||
DROP TEMPORARY TABLE IF EXISTS edi.offer;
|
||||
CREATE TEMPORARY TABLE edi.offer (INDEX (`srID`), INDEX (`EmbalageCode`)) 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;
|
||||
|
||||
|
||||
START TRANSACTION;
|
||||
|
||||
-- Actualizamos el campo supplyResponseFk para aquellos articulos que ya estan creados y reutilizamos
|
||||
UPDATE IGNORE edi.offer o
|
||||
LEFT JOIN vn.item iExist ON iExist.supplyResponseFk = o.srID
|
||||
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
|
||||
LEFT JOIN deliveryInformation di ON di.supplyResponseID = i.supplyResponseFk
|
||||
JOIN vn.itemType it ON it.id = i.typeFk
|
||||
SET i.supplyResponseFk = o.srID
|
||||
WHERE iExist.id IS NULL
|
||||
AND (di.LatestOrderDateTime < NOW() OR di.ID IS NULL)
|
||||
AND it.isInventory
|
||||
;
|
||||
-- select now(),'Antes de crear ITO';
|
||||
DROP TEMPORARY TABLE IF EXISTS itemToInsert;
|
||||
CREATE TEMPORARY TABLE itemToInsert ENGINE = MEMORY
|
||||
SELECT o.*, CAST(NULL AS DECIMAL(6,0)) as 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 done 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,
|
||||
expenceFk,
|
||||
typeFk,
|
||||
intrastatFk,
|
||||
originFk,
|
||||
supplyResponseFk,
|
||||
numberOfItemsPerCask,
|
||||
embalageCode,
|
||||
quality,
|
||||
isFloramondo)
|
||||
SELECT itemFk,
|
||||
product_name,
|
||||
product_name,
|
||||
company_name,
|
||||
expenseFk,
|
||||
itemTypeFk,
|
||||
intrastatFk,
|
||||
originFk,
|
||||
`srId`,
|
||||
NumberOfItemsPerCask,
|
||||
EmbalageCode,
|
||||
Quality,
|
||||
TRUE
|
||||
FROM itemToInsert;
|
||||
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
-- Inserta los tags sólo en los articulos nuevos
|
||||
|
||||
-- desabilita el trigger para recalcular los tags al final
|
||||
SET @isTriggerDisabled = TRUE;
|
||||
|
||||
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`;
|
||||
|
||||
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`;
|
||||
|
||||
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`;
|
||||
|
||||
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 s1Value != '';
|
||||
|
||||
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 s2Value != '';
|
||||
|
||||
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 s3Value != '';
|
||||
|
||||
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 s4Value != '';
|
||||
|
||||
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 s5Value != '';
|
||||
|
||||
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 s6Value != '';
|
||||
|
||||
INSERT INTO vn.itemTag(itemFk, tagFk, value, priority)
|
||||
SELECT i.id, t.id, ink.name, 11
|
||||
FROM itemToInsert ii
|
||||
JOIN vn.item i ON i.supplyResponseFk = ii.`srId`
|
||||
JOIN vn.tag t ON t.`name` = 'Color'
|
||||
JOIN edi.feature f ON f.item_id = ii.Item_ArticleCode
|
||||
JOIN edi.`type` tp ON tp.type_id = f.feature_type_id AND tp.`description` = 'Hoofdkleur 1'
|
||||
JOIN vn.ink ON ink.dutchCode = f.feature_value;
|
||||
|
||||
UPDATE vn.item i
|
||||
JOIN itemToInsert ii ON i.supplyResponseFk = ii.`srId`
|
||||
JOIN vn.packaging p ON p.id LIKE ii.EmbalageCode AND hasCompressionVariations
|
||||
JOIN vn.itemTag diameter ON diameter.itemFk = i.id
|
||||
JOIN vn.tag tDiameter ON tDiameter.overwrite = 'diameter' AND tDiameter.id = diameter.tagFk
|
||||
JOIN vn.itemTag size ON size.itemFk = i.id
|
||||
JOIN vn.tag tSize ON tSize.overwrite = 'size' AND tSize.id = size.tagFk
|
||||
SET i.`compression` =
|
||||
(PI() * POW(diameter.`value`/ 2, 2) * size.`value`)
|
||||
/
|
||||
((p.width * p.depth * p.height) / ii.NumberOfItemsPerCask);
|
||||
|
||||
DROP TABLE IF EXISTS tmp.item;
|
||||
CREATE 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();
|
||||
|
||||
SET @isTriggerDisabled = FALSE;
|
||||
|
||||
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(NOW()), CURDATE(), TIMESTAMPADD(DAY,1,CURDATE()));
|
||||
|
||||
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
|
||||
|
@ -10378,14 +10813,14 @@ proc: BEGIN
|
|||
AND sr.ID IS NULL
|
||||
AND am.name = 'LOGIFLORA'
|
||||
AND e.isRaid;
|
||||
/*
|
||||
|
||||
UPDATE vn.buy b
|
||||
JOIN edi.warehouseFloramondo wf ON wf.entryFk = b.entryFk
|
||||
JOIN vn.item i ON i.id = b.itemFk
|
||||
LEFT JOIN edi.supplyResponse sr ON sr.ID = i.supplyResponseFk
|
||||
SET b.quantity = 0
|
||||
WHERE sr.ID IS NULL;
|
||||
*/
|
||||
|
||||
-- Localiza las entradas de cada almacen
|
||||
UPDATE edi.warehouseFloramondo
|
||||
SET entryFk = vn.floramondo_getEntry(TIMESTAMPADD(DAY,travellingDays,vLanded), warehouseFk);
|
||||
|
@ -20603,7 +21038,7 @@ BEGIN
|
|||
mc.ImporteRetencion,
|
||||
mc.SiglaNacion,
|
||||
mc.EjercicioFactura,
|
||||
mc.FechaOperacion,
|
||||
x.FECHA,
|
||||
mc.Exclusion347,
|
||||
mc.MantenerAsiento,
|
||||
mc.Metalico347,
|
||||
|
@ -24440,7 +24875,8 @@ SET character_set_client = utf8;
|
|||
`account` tinyint NOT NULL,
|
||||
`accountingTypeFk` tinyint NOT NULL,
|
||||
`entityFk` tinyint NOT NULL,
|
||||
`isActive` tinyint NOT NULL
|
||||
`isActive` tinyint NOT NULL,
|
||||
`currencyFk` tinyint NOT NULL
|
||||
) ENGINE=MyISAM */;
|
||||
SET character_set_client = @saved_cs_client;
|
||||
|
||||
|
@ -25206,8 +25642,8 @@ DROP TABLE IF EXISTS `botanicExport`;
|
|||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `botanicExport` (
|
||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`vnGenusFk` mediumint(8) unsigned NOT NULL,
|
||||
`vnSpecieFk` mediumint(8) unsigned DEFAULT NULL,
|
||||
`ediGenusFk` mediumint(8) unsigned NOT NULL,
|
||||
`ediSpecieFk` mediumint(8) unsigned DEFAULT NULL,
|
||||
`countryFk` mediumint(8) unsigned DEFAULT NULL,
|
||||
`restriction` enum('Sin restriccion','Importacion Prohibida','pasaporte fitosanitario','pasaporte individual','declaracion origen') CHARACTER SET utf8 NOT NULL,
|
||||
`description` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
|
||||
|
@ -25215,8 +25651,8 @@ CREATE TABLE `botanicExport` (
|
|||
`code` enum('importProhibited','phytosanitaryPassport','individualPassport') COLLATE utf8_unicode_ci DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `Id_Paises` (`countryFk`),
|
||||
KEY `botanicExport_ibfk_2_idx` (`vnGenusFk`),
|
||||
KEY `botanicExport_ibfk_3_idx` (`vnSpecieFk`),
|
||||
KEY `botanicExport_ibfk_2_idx` (`ediGenusFk`),
|
||||
KEY `botanicExport_ibfk_3_idx` (`ediSpecieFk`),
|
||||
CONSTRAINT `botanicExport_ibfk_1` FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`)
|
||||
) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Especifica los generos y especies prohibidos en paises';
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
@ -25231,7 +25667,7 @@ CREATE TABLE `botanicExport` (
|
|||
DELIMITER ;;
|
||||
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vn`.`botanicExport_beforeInsert` BEFORE INSERT ON `botanicExport` FOR EACH ROW
|
||||
BEGIN
|
||||
IF (SELECT botanicExport_isUpdatable (NEW.vnGenusFk, NEW.vnSpecieFk, NEW.countryFk, NEW.restriction) ) > 0 THEN
|
||||
IF (SELECT botanicExport_isUpdatable (NEW.ediGenusFk, NEW.ediSpecieFk, NEW.countryFk, NEW.restriction) ) > 0 THEN
|
||||
CALL util.throw ('Datos duplicados');
|
||||
END IF;
|
||||
END */;;
|
||||
|
@ -28247,30 +28683,37 @@ DELIMITER ;
|
|||
/*!50003 SET collation_connection = @saved_col_connection */ ;
|
||||
|
||||
--
|
||||
-- Temporary table structure for view `vnGenus`
|
||||
-- Temporary table structure for view `ediGenus`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `vnGenus`;
|
||||
/*!50001 DROP VIEW IF EXISTS `vnGenus`*/;
|
||||
DROP TABLE IF EXISTS `ediGenus`;
|
||||
/*!50001 DROP VIEW IF EXISTS `ediGenus`*/;
|
||||
SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
/*!50001 CREATE TABLE `vnGenus` (
|
||||
/*!50001 CREATE TABLE `ediGenus` (
|
||||
`id` tinyint NOT NULL,
|
||||
`name` tinyint NOT NULL
|
||||
`latinGenusName` tinyint NOT NULL,
|
||||
`entried` tinyint NOT NULL,
|
||||
`dued` tinyint NOT NULL,
|
||||
`modified` tinyint NOT NULL
|
||||
) ENGINE=MyISAM */;
|
||||
SET character_set_client = @saved_cs_client;
|
||||
|
||||
--
|
||||
-- Temporary table structure for view `vnSpecie`
|
||||
-- Temporary table structure for view `ediSpecie`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `vnSpecie`;
|
||||
/*!50001 DROP VIEW IF EXISTS `vnSpecie`*/;
|
||||
DROP TABLE IF EXISTS `ediSpecie`;
|
||||
/*!50001 DROP VIEW IF EXISTS `ediSpecie`*/;
|
||||
SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
/*!50001 CREATE TABLE `vnSpecie` (
|
||||
/*!50001 CREATE TABLE `ediSpecie` (
|
||||
`id` tinyint NOT NULL,
|
||||
`name` tinyint NOT NULL
|
||||
`genusFk` tinyint NOT NULL,
|
||||
`latinSpeciesName` tinyint NOT NULL,
|
||||
`entried` tinyint NOT NULL,
|
||||
`dued` tinyint NOT NULL,
|
||||
`modified` tinyint NOT NULL
|
||||
) ENGINE=MyISAM */;
|
||||
SET character_set_client = @saved_cs_client;
|
||||
|
||||
|
@ -28642,6 +29085,26 @@ CREATE TABLE `entryLog` (
|
|||
) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `entryObservation`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `entryObservation`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `entryObservation` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`entryFk` int(11) NOT NULL,
|
||||
`observationTypeFk` tinyint(3) unsigned DEFAULT NULL,
|
||||
`description` text COLLATE utf8_unicode_ci DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `entryFk_observationTypeFk_UNIQUE` (`entryFk`,`observationTypeFk`),
|
||||
KEY `observationType_id_observationTypeFk` (`observationTypeFk`),
|
||||
CONSTRAINT `entry_id_entryFk` FOREIGN KEY (`entryFk`) REFERENCES `entry` (`id`),
|
||||
CONSTRAINT `observationType_id_observationTypeFk` FOREIGN KEY (`observationTypeFk`) REFERENCES `observationType` (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `entryShelving__`
|
||||
--
|
||||
|
@ -30749,14 +31212,13 @@ DROP TABLE IF EXISTS `itemBotanical`;
|
|||
CREATE TABLE `itemBotanical` (
|
||||
`itemFk` int(11) NOT NULL,
|
||||
`botanical` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
|
||||
`genusFk` int(11) DEFAULT NULL,
|
||||
`genusFk` int(11) NOT NULL,
|
||||
`specieFk` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`itemFk`),
|
||||
KEY `genusFgn_idx` (`genusFk`),
|
||||
KEY `specieFgn_idx` (`specieFk`),
|
||||
CONSTRAINT `itemBotanicalItemFkFk` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT `itemBotanical_FK` FOREIGN KEY (`specieFk`) REFERENCES `specie` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
CONSTRAINT `itemBotanical_fk2` FOREIGN KEY (`genusFk`) REFERENCES `genus` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
|
||||
CONSTRAINT `itemBotanical_FK` FOREIGN KEY (`specieFk`) REFERENCES `specie` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Sustituye a antiguo NomBotanic de Articles';
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
|
||||
|
@ -33971,7 +34433,16 @@ DELIMITER ;;
|
|||
BEFORE INSERT
|
||||
ON receipt FOR EACH ROW
|
||||
BEGIN
|
||||
DECLARE vIsAutoConciliated BOOLEAN;
|
||||
|
||||
IF NEW.isConciliate = FALSE THEN
|
||||
SELECT isAutoConciliated INTO vIsAutoConciliated
|
||||
FROM accounting a
|
||||
JOIN accountingType at2 ON at2.id = a.accountingTypeFk
|
||||
WHERE a.id = NEW.bankFk;
|
||||
|
||||
SET NEW.isConciliate = vIsAutoConciliated;
|
||||
END IF;
|
||||
END */;;
|
||||
DELIMITER ;
|
||||
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
||||
|
@ -35765,6 +36236,8 @@ CREATE TABLE `supplier` (
|
|||
`withholdingSageFk` smallint(6) DEFAULT NULL COMMENT 'Tipos de retención SAGE',
|
||||
`transactionTypeSageFk` tinyint(4) DEFAULT NULL COMMENT 'Ti po de transacción SAGE',
|
||||
`isTrucker` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`supplierActivityFk` varchar(45) NOT NULL DEFAULT 'flowersPlants',
|
||||
`healthRegister` varchar(45) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `cuenta` (`account`),
|
||||
UNIQUE KEY `NIF` (`nif`),
|
||||
|
@ -35776,13 +36249,15 @@ CREATE TABLE `supplier` (
|
|||
KEY `supplier_taxTypeFk_idx` (`taxTypeSageFk`),
|
||||
KEY `supplier_withholdingFk_idx` (`withholdingSageFk`),
|
||||
KEY `supplier_transactionFk_idx` (`transactionTypeSageFk`),
|
||||
KEY `suppplier_supplierActivityFk` (`supplierActivityFk`),
|
||||
CONSTRAINT `Id_Pais` FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`) ON UPDATE CASCADE,
|
||||
CONSTRAINT `pay_dem_id` FOREIGN KEY (`payDemFk`) REFERENCES `payDem` (`id`) ON UPDATE CASCADE,
|
||||
CONSTRAINT `pay_met_id` FOREIGN KEY (`payMethodFk`) REFERENCES `payMethod` (`id`) ON UPDATE CASCADE,
|
||||
CONSTRAINT `province_id` FOREIGN KEY (`provinceFk`) REFERENCES `province` (`id`) ON UPDATE CASCADE,
|
||||
CONSTRAINT `supplier_taxTypeFk` FOREIGN KEY (`taxTypeSageFk`) REFERENCES `sage`.`TiposIva` (`CodigoIva`) ON UPDATE CASCADE,
|
||||
CONSTRAINT `supplier_transactionFk` FOREIGN KEY (`transactionTypeSageFk`) REFERENCES `sage`.`TiposTransacciones` (`CodigoTransaccion`) ON UPDATE CASCADE,
|
||||
CONSTRAINT `supplier_withholdingFk` FOREIGN KEY (`withholdingSageFk`) REFERENCES `sage`.`TiposRetencion` (`CodigoRetencion`) ON UPDATE CASCADE
|
||||
CONSTRAINT `supplier_withholdingFk` FOREIGN KEY (`withholdingSageFk`) REFERENCES `sage`.`TiposRetencion` (`CodigoRetencion`) ON UPDATE CASCADE,
|
||||
CONSTRAINT `suppplier_supplierActivityFk` FOREIGN KEY (`supplierActivityFk`) REFERENCES `supplierActivity` (`code`) ON UPDATE CASCADE
|
||||
) ENGINE=InnoDBDEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
|
@ -35838,6 +36313,20 @@ DELIMITER ;
|
|||
/*!50003 SET character_set_results = @saved_cs_results */ ;
|
||||
/*!50003 SET collation_connection = @saved_col_connection */ ;
|
||||
|
||||
--
|
||||
-- Table structure for table `supplierActivity`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `supplierActivity`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `supplierActivity` (
|
||||
`code` varchar(45) CHARACTER SET utf8 NOT NULL,
|
||||
`name` varchar(45) COLLATE utf8_unicode_ci NOT NULL,
|
||||
PRIMARY KEY (`code`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `supplierContact`
|
||||
--
|
||||
|
@ -39672,15 +40161,15 @@ DELIMITER ;
|
|||
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
|
||||
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
|
||||
DELIMITER ;;
|
||||
CREATE DEFINER=`root`@`%` FUNCTION `botanicExport_isUpdatable`(vVnGenusFk MEDIUMINT,vVnSpecieFk MEDIUMINT,
|
||||
CREATE DEFINER=`root`@`%` FUNCTION `botanicExport_isUpdatable`(vEdiGenusFk MEDIUMINT,vEdiSpecieFk MEDIUMINT,
|
||||
vCountryFk MEDIUMINT,vRestriction MEDIUMINT) RETURNS int(11)
|
||||
DETERMINISTIC
|
||||
BEGIN
|
||||
DECLARE vIsUpdatable INTEGER;
|
||||
SELECT COUNT(*) INTO vIsUpdatable
|
||||
FROM botanicExport
|
||||
WHERE vnGenusFk = vVnGenusFk
|
||||
AND (vVnSpecieFk = vnSpecieFk OR IFNULL(vVnSpecieFk,vnSpecieFk) IS NULL)
|
||||
WHERE ediGenusFk = vEdiGenusFk
|
||||
AND (vEdiSpecieFk = ediSpecieFk OR IFNULL(vEdiSpecieFk,ediSpecieFk) IS NULL)
|
||||
AND (vCountryFk = countryFk OR IFNULL(vCountryFk,countryFk) IS NULL)
|
||||
AND vRestriction = restriction;
|
||||
RETURN vIsUpdatable;
|
||||
|
@ -39779,8 +40268,8 @@ BEGIN
|
|||
SELECT COUNT(*) INTO vHasPassport
|
||||
FROM botanicExport be
|
||||
JOIN itemBotanical ib
|
||||
ON be.vnGenusFk = ib.genusFk
|
||||
AND IFNULL(be.vnSpecieFk, ib.specieFk) = ib.specieFk
|
||||
ON be.ediGenusFk = ib.genusFk
|
||||
AND IFNULL(be.ediSpecieFk, ib.specieFk) = ib.specieFk
|
||||
AND be.`code` = 'phytosanitaryPassport'
|
||||
JOIN item i ON i.id = ib.itemFk
|
||||
JOIN itemType it ON it.id = i.typeFk
|
||||
|
@ -42666,12 +43155,12 @@ FROM
|
|||
JOIN
|
||||
botanicExport be ON be.`code` = 'phytosanitaryPassport'
|
||||
LEFT JOIN
|
||||
vnGenus vg ON vg.id = be.vnGenusFk
|
||||
ediGenus eg ON eg.id = be.ediGenusFk
|
||||
LEFT JOIN
|
||||
vnSpecie vs ON vs.id = be.vnSpecieFk
|
||||
ediSpecie es ON es.id = be.ediSpecieFk
|
||||
WHERE
|
||||
t.refFk = vRef
|
||||
AND ib.ediBotanic LIKE CONCAT(IFNULL(vg.latinGenusName, ''),
|
||||
AND ib.ediBotanic LIKE CONCAT(IFNULL(eg.latinGenusName, ''),
|
||||
IF(latinSpeciesName > '',
|
||||
CONCAT(' ', latinSpeciesName),
|
||||
''),
|
||||
|
@ -44752,14 +45241,14 @@ BEGIN
|
|||
', Packing: ', IFNULL(vPacking, 0),
|
||||
', Nombre: ', IFNULL(i.`name`, 0),
|
||||
', buy_edi: ', IFNULL(e.id, 0),
|
||||
', Nombre botánico: ', IFNULL(g.name, ''), ' ', IFNULL(s.name, ''),
|
||||
', Nombre botánico: ', IFNULL(g.latin_genus_name, ''), ' ', IFNULL(s.latin_species_name, ''),
|
||||
', Productor: ',IFNULL(es.company_name, IFNULL(p.`name`, ''))
|
||||
)
|
||||
,'ekt@verdnatura.es'
|
||||
FROM item i
|
||||
LEFT JOIN itemBotanical ib ON ib.itemFk = i.id
|
||||
LEFT JOIN vn.genus g ON g.id = ib.genusFk
|
||||
LEFT JOIN vn.specie s ON IFNULL(s.specie_id, ib.specieFk) = ib.specieFk
|
||||
LEFT JOIN edi.genus g ON g.genus_id = ib.genusFk
|
||||
LEFT JOIN edi.specie s ON IFNULL(s.specie_id, ib.specieFk) = ib.specieFk
|
||||
LEFT JOIN producer p ON p.id = i.producerFk
|
||||
LEFT JOIN buy b ON b.id = vBuyFk
|
||||
LEFT JOIN edi.ekt e ON b.ektFk = e.id
|
||||
|
@ -50878,12 +51367,12 @@ CREATE DEFINER=`z-developer`@`%` PROCEDURE `ediTables_Update`()
|
|||
BEGIN
|
||||
|
||||
INSERT IGNORE INTO vn.genus(name)
|
||||
SELECT name
|
||||
FROM vn.genus ;
|
||||
SELECT latin_genus_name
|
||||
FROM edi.genus ;
|
||||
|
||||
INSERT IGNORE INTO vn.specie(name)
|
||||
SELECT LCASE(name)
|
||||
FROM vn.specie ;
|
||||
SELECT LCASE(latin_species_name)
|
||||
FROM edi.specie ;
|
||||
END ;;
|
||||
DELIMITER ;
|
||||
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
||||
|
@ -77937,7 +78426,7 @@ USE `vn`;
|
|||
/*!50001 SET collation_connection = utf8mb4_general_ci */;
|
||||
/*!50001 CREATE ALGORITHM=UNDEFINED */
|
||||
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
|
||||
/*!50001 VIEW `accounting` AS select `b`.`Id_Banco` AS `id`,`b`.`Banco` AS `bank`,`b`.`Cuenta` AS `account`,`b`.`cash` AS `accountingTypeFk`,`b`.`entity_id` AS `entityFk`,`b`.`activo` AS `isActive` from `vn2008`.`Bancos` `b` */;
|
||||
/*!50001 VIEW `accounting` AS select `b`.`id` AS `id`,`b`.`bank` AS `bank`,`b`.`account` AS `account`,`b`.`cash` AS `accountingTypeFk`,`b`.`entityFk` AS `entityFk`,`b`.`isActive` AS `isActive`,`b`.`currencyFk` AS `currencyFk` from `bank` `b` */;
|
||||
/*!50001 SET character_set_client = @saved_cs_client */;
|
||||
/*!50001 SET character_set_results = @saved_cs_results */;
|
||||
/*!50001 SET collation_connection = @saved_col_connection */;
|
||||
|
@ -78285,11 +78774,11 @@ USE `vn`;
|
|||
/*!50001 SET collation_connection = @saved_col_connection */;
|
||||
|
||||
--
|
||||
-- Final view structure for view `vnGenus`
|
||||
-- Final view structure for view `ediGenus`
|
||||
--
|
||||
|
||||
/*!50001 DROP TABLE IF EXISTS `vnGenus`*/;
|
||||
/*!50001 DROP VIEW IF EXISTS `vnGenus`*/;
|
||||
/*!50001 DROP TABLE IF EXISTS `ediGenus`*/;
|
||||
/*!50001 DROP VIEW IF EXISTS `ediGenus`*/;
|
||||
/*!50001 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!50001 SET @saved_cs_results = @@character_set_results */;
|
||||
/*!50001 SET @saved_col_connection = @@collation_connection */;
|
||||
|
@ -78298,17 +78787,17 @@ USE `vn`;
|
|||
/*!50001 SET collation_connection = utf8_general_ci */;
|
||||
/*!50001 CREATE ALGORITHM=UNDEFINED */
|
||||
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
|
||||
/*!50001 VIEW `vnGenus` AS select `g`.`id` AS `id`,`g`.`name` AS `latinGenusName`,`g` from `vn`.`genus` `g` */;
|
||||
/*!50001 VIEW `ediGenus` AS select `g`.`genus_id` AS `id`,`g`.`latin_genus_name` AS `latinGenusName`,`g`.`entry_date` AS `entried`,`g`.`expiry_date` AS `dued`,`g`.`change_date_time` AS `modified` from `edi`.`genus` `g` */;
|
||||
/*!50001 SET character_set_client = @saved_cs_client */;
|
||||
/*!50001 SET character_set_results = @saved_cs_results */;
|
||||
/*!50001 SET collation_connection = @saved_col_connection */;
|
||||
|
||||
--
|
||||
-- Final view structure for view `vnSpecie`
|
||||
-- Final view structure for view `ediSpecie`
|
||||
--
|
||||
|
||||
/*!50001 DROP TABLE IF EXISTS `vnSpecie`*/;
|
||||
/*!50001 DROP VIEW IF EXISTS `vnSpecie`*/;
|
||||
/*!50001 DROP TABLE IF EXISTS `ediSpecie`*/;
|
||||
/*!50001 DROP VIEW IF EXISTS `ediSpecie`*/;
|
||||
/*!50001 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!50001 SET @saved_cs_results = @@character_set_results */;
|
||||
/*!50001 SET @saved_col_connection = @@collation_connection */;
|
||||
|
@ -78317,7 +78806,7 @@ USE `vn`;
|
|||
/*!50001 SET collation_connection = utf8_general_ci */;
|
||||
/*!50001 CREATE ALGORITHM=UNDEFINED */
|
||||
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
|
||||
/*!50001 VIEW `vnSpecie` AS select `s`.`id` AS `id`,`s`.`name` AS `latinSpeciesName`,`s` from `vn`.`specie` `s` */;
|
||||
/*!50001 VIEW `ediSpecie` AS select `s`.`specie_id` AS `id`,`s`.`genus_id` AS `genusFk`,`s`.`latin_species_name` AS `latinSpeciesName`,`s`.`entry_date` AS `entried`,`s`.`expiry_date` AS `dued`,`s`.`change_date_time` AS `modified` from `edi`.`specie` `s` */;
|
||||
/*!50001 SET character_set_client = @saved_cs_client */;
|
||||
/*!50001 SET character_set_results = @saved_cs_results */;
|
||||
/*!50001 SET collation_connection = @saved_col_connection */;
|
||||
|
@ -78849,7 +79338,7 @@ USE `vn`;
|
|||
/*!50001 SET collation_connection = utf8mb4_general_ci */;
|
||||
/*!50001 CREATE ALGORITHM=UNDEFINED */
|
||||
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
|
||||
/*!50001 VIEW `itemBotanicalWithGenus` AS select `ib`.`itemFk` AS `itemFk`,ifnull(`ib`.`botanical`,concat(`g`.`latinGenusName`,' ',ifnull(`s`.`latinSpeciesName`,''))) AS `ediBotanic` from ((`vn`.`itemBotanical` `ib` left join `vn`.`vnGenus` `g` on(`g`.`id` = `ib`.`genusFk`)) left join `vn`.`vnSpecie` `s` on(`s`.`id` = `ib`.`specieFk`)) */;
|
||||
/*!50001 VIEW `itemBotanicalWithGenus` AS select `ib`.`itemFk` AS `itemFk`,ifnull(`ib`.`botanical`,concat(`g`.`latinGenusName`,' ',ifnull(`s`.`latinSpeciesName`,''))) AS `ediBotanic` from ((`vn`.`itemBotanical` `ib` left join `vn`.`ediGenus` `g` on(`g`.`id` = `ib`.`genusFk`)) left join `vn`.`ediSpecie` `s` on(`s`.`id` = `ib`.`specieFk`)) */;
|
||||
/*!50001 SET character_set_client = @saved_cs_client */;
|
||||
/*!50001 SET character_set_results = @saved_cs_results */;
|
||||
/*!50001 SET collation_connection = @saved_col_connection */;
|
||||
|
@ -80237,4 +80726,4 @@ USE `vncontrol`;
|
|||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2021-03-02 7:45:42
|
||||
-- Dump completed on 2021-03-04 8:02:58
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
fdescribe('Entry observations path', () => {
|
||||
describe('Entry observations path', () => {
|
||||
let browser;
|
||||
let page;
|
||||
|
||||
|
|
Loading…
Reference in New Issue