Merge branch 'dev' into 7409-workerIncome
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Carlos Satorres 2024-06-26 08:00:58 +00:00
commit f9a09f3fec
6 changed files with 83 additions and 17 deletions

View File

@ -1,16 +1,15 @@
DROP PROCEDURE IF EXISTS floranet.catalogue_get;
DELIMITER $$ DELIMITER $$
$$ $$
CREATE DEFINER=`root`@`localhost` PROCEDURE floranet.catalogue_get(vLanded DATE, vPostalCode VARCHAR(15)) CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE floranet.catalogue_get(vLanded DATE, vPostalCode VARCHAR(15))
READS SQL DATA READS SQL DATA
proc:BEGIN proc:BEGIN
/** /**
* Returns list, price and all the stuff regarding the floranet items. * Returns list, price and all the stuff regarding the floranet items, for the designed shop
* *
* @param vLanded Delivery date * @param vLanded Delivery date
* @param vPostalCode Delivery address postal code * @param vPostalCode Delivery address postal code
*/ */
DECLARE vAddressFk INT;
DECLARE vLastCatalogueFk INT; DECLARE vLastCatalogueFk INT;
DECLARE vLockName VARCHAR(20); DECLARE vLockName VARCHAR(20);
DECLARE vLockTime INT; DECLARE vLockTime INT;
@ -32,6 +31,15 @@ proc:BEGIN
SELECT MAX(id) INTO vLastCatalogueFk SELECT MAX(id) INTO vLastCatalogueFk
FROM catalogue; FROM catalogue;
SELECT addressFk
INTO vAddressFk
FROM addressPostCode apc
WHERE apc.dayOfWeek = dayOfWeek(vLanded)
AND NOW() < vLanded - INTERVAL apc.hoursInAdvance HOUR
AND apc.postCode = vPostalCode
-- Aquí hay que incluir los criterios de selección de tienda
LIMIT 1;
INSERT INTO catalogue( INSERT INTO catalogue(
name, name,
price, price,
@ -51,17 +59,14 @@ proc:BEGIN
it.name, it.name,
CONCAT('https://cdn.verdnatura.es/image/catalog/1600x900/', i.image), CONCAT('https://cdn.verdnatura.es/image/catalog/1600x900/', i.image),
i.description, i.description,
apc.addressFk vAddressFk
FROM vn.item i FROM vn.item i
JOIN (SELECT itemFk, SUM(quantity * cost) price JOIN (SELECT itemFk, SUM(quantity * cost) price
FROM recipe FROM recipe
GROUP BY itemFk) r ON r.itemFk = i.id GROUP BY itemFk) r ON r.itemFk = i.id
JOIN vn.itemType it ON it.id = i.typeFk JOIN vn.itemType it ON it.id = i.typeFk
JOIN addressPostCode apc JOIN addressPostCode apc ON addressFk = vAddressFk
ON apc.dayOfWeek = dayOfWeek(vLanded) JOIN vn.address a ON a.id = vAddressFk;
AND NOW() < vLanded - INTERVAL apc.hoursInAdvance HOUR
AND apc.postCode = vPostalCode
JOIN vn.address a ON a.id = apc.addressFk;
SELECT * SELECT *
FROM catalogue FROM catalogue

View File

@ -1,8 +1,6 @@
DROP PROCEDURE IF EXISTS floranet.deliveryDate_get;
DELIMITER $$ DELIMITER $$
$$ $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `floranet`.`deliveryDate_get`(vPostalCode VARCHAR(15)) CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `floranet`.`deliveryDate_get`(vPostalCode VARCHAR(15))
READS SQL DATA READS SQL DATA
BEGIN BEGIN
/** /**

View File

@ -101,7 +101,7 @@ proc:BEGIN
vNewTicketFk, vNewTicketFk,
c.itemFk, c.itemFk,
CONCAT('Entrega: ',c.name), CONCAT('Entrega: ',c.name),
- c.price, - apc.deliveryCost,
1 1
FROM catalogue c FROM catalogue c
JOIN addressPostCode apc JOIN addressPostCode apc
@ -119,7 +119,7 @@ proc:BEGIN
vNewTicketFk, vNewTicketFk,
r.elementFk, r.elementFk,
i.longName, i.longName,
r.cost, 0,
r.quantity r.quantity
FROM catalogue c FROM catalogue c
JOIN recipe r ON r.itemFk = c.itemFk JOIN recipe r ON r.itemFk = c.itemFk

View File

@ -0,0 +1,8 @@
-- Place your SQL code here
USE vn;
INSERT INTO salix.ACL ( model, property, accessType, permission, principalType, principalId) VALUES('ItemShelvingLog', '*', 'READ', 'ALLOW', 'ROLE', 'production');
-- redmine regularitzar parking per a que no tinguen espais
ALTER TABLE parking DROP CONSTRAINT chkParkingCodeFormat;
ALTER TABLE parking
ADD CONSTRAINT chkParkingCodeFormat CHECK (CHAR_LENGTH(code) > 4 AND code REGEXP ('^[^ ]+-[^ ]+$'));

View File

@ -50,6 +50,9 @@
"ItemShelving": { "ItemShelving": {
"dataSource": "vn" "dataSource": "vn"
}, },
"ItemShelvingLog": {
"dataSource": "vn"
},
"ItemShelvingSale": { "ItemShelvingSale": {
"dataSource": "vn" "dataSource": "vn"
}, },

View File

@ -0,0 +1,52 @@
{
"name": "ItemShelvingLog",
"base": "VnModel",
"mixins": {
"Loggable": true
},
"options": {
"mysql": {
"table": "itemShelvingLog"
}
},
"properties": {
"id": {
"type": "number",
"id": true,
"description": "Identifier"
},
"created": {
"type": "date"
},
"shelvingFk": {
"type": "string"
},
"itemFk": {
"type": "number"
},
"visible": {
"type": "number"
},
"accion": {
"type": "string"
}
},
"relations": {
"item": {
"type": "belongsTo",
"model": "Item",
"foreignKey": "itemFk"
},
"worker": {
"type": "belongsTo",
"model": "Worker",
"foreignKey": "workerFk"
},
"shelving": {
"type": "belongsTo",
"model": "Shelving",
"foreignKey": "shelvingFk",
"primaryKey": "code"
}
}
}