7773-testToMaster_2430 #2774
|
@ -9,24 +9,24 @@
|
|||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"id": true,
|
||||
"type": "number",
|
||||
"forceId": false
|
||||
"id": true,
|
||||
"type": "number",
|
||||
"forceId": false
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
"type": "string"
|
||||
},
|
||||
"code": {
|
||||
"type": "string"
|
||||
"type": "string"
|
||||
},
|
||||
"isInventory": {
|
||||
"type": "number"
|
||||
"type": "number"
|
||||
},
|
||||
"isManaged":{
|
||||
"type": "boolean"
|
||||
"isManaged": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"countryFk": {
|
||||
"type": "number"
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
|
@ -36,6 +36,13 @@
|
|||
"foreignKey": "countryFk"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
"address": {
|
||||
"type": "belongsTo",
|
||||
"model": "Address",
|
||||
"foreignKey": "addressFk"
|
||||
}
|
||||
},
|
||||
"acls": [
|
||||
{
|
||||
"accessType": "READ",
|
||||
|
@ -44,5 +51,11 @@
|
|||
"permission": "ALLOW"
|
||||
}
|
||||
],
|
||||
"scope" : {"where": {"isForTicket": {"neq": 0}}}
|
||||
}
|
||||
"scope": {
|
||||
"where": {
|
||||
"isForTicket": {
|
||||
"neq": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -3232,7 +3232,6 @@ INSERT IGNORE INTO vn.itemType
|
|||
workerFk = 103,
|
||||
isInventory = TRUE,
|
||||
life = 10,
|
||||
density = 250,
|
||||
itemPackingTypeFk = NULL,
|
||||
temperatureFk = 'warm';
|
||||
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `account`.`mailAliasAccount_afterDelete`
|
||||
AFTER DELETE ON `mailAliasAccount`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
INSERT INTO userLog
|
||||
SET `action` = 'delete',
|
||||
`changedModel` = 'MailAliasAccount',
|
||||
`changedModelId` = OLD.id,
|
||||
`userFk` = account.myUser_getId();
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -0,0 +1,8 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `account`.`mailAliasAccount_beforeInsert`
|
||||
BEFORE INSERT ON `mailAliasAccount`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
SET NEW.editorFk = account.myUser_getId();
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -0,0 +1,8 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `account`.`mailAliasAccount_beforeUpdate`
|
||||
BEFORE UPDATE ON `mailAliasAccount`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
SET NEW.editorFk = account.myUser_getId();
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -59,7 +59,7 @@ BEGIN
|
|||
JOIN vn.saleComponent sc ON sc.saleFk = s.id
|
||||
JOIN vn.component c ON c.id = sc.componentFk
|
||||
JOIN vn.componentType ct ON ct.id = c.typeFk
|
||||
WHERE ct.code = 'FREIGHT'
|
||||
WHERE ct.code = 'freight'
|
||||
AND r.created BETWEEN vDatedFrom AND vDatedTo
|
||||
GROUP BY r.id
|
||||
) sub ON sub.routeFk = r.Id_Ruta
|
||||
|
|
|
@ -2,7 +2,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost`
|
|||
SQL SECURITY DEFINER
|
||||
VIEW `bi`.`tarifa_componentes_series`
|
||||
AS SELECT `ct`.`id` AS `tarifa_componentes_series_id`,
|
||||
`ct`.`type` AS `Serie`,
|
||||
`ct`.`name` AS `Serie`,
|
||||
`ct`.`isBase` AS `base`,
|
||||
`ct`.`isMargin` AS `margen`
|
||||
FROM `vn`.`componentType` `ct`
|
||||
|
|
|
@ -117,7 +117,7 @@ proc: BEGIN
|
|||
)sub
|
||||
GROUP BY sub.itemFk;
|
||||
|
||||
DROP TEMPORARY TABLE tmp.itemCalc, tItemRange;
|
||||
DROP TEMPORARY TABLE tmp.itemCalc, tItemRange, tmp.itemList;
|
||||
CALL cache_calc_end (vCalc);
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -121,7 +121,7 @@ proc: BEGIN
|
|||
)sub
|
||||
GROUP BY sub.itemFk;
|
||||
|
||||
DROP TEMPORARY TABLE tmp.itemCalc, itemRange;
|
||||
DROP TEMPORARY TABLE tmp.itemCalc, itemRange, tmp.itemList;
|
||||
CALL cache_calc_end (vCalc);
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -7,7 +7,6 @@ BEGIN
|
|||
*/
|
||||
DECLARE vRewriteKop INT DEFAULT NULL;
|
||||
DECLARE vTruncatePutOrder INT DEFAULT NULL;
|
||||
DECLARE vBarcode CHAR(15) DEFAULT NULL;
|
||||
DECLARE vKop INT;
|
||||
DECLARE vPutOrderFk BIGINT;
|
||||
|
||||
|
@ -16,17 +15,6 @@ BEGIN
|
|||
FROM ekt
|
||||
WHERE id = vSelf;
|
||||
|
||||
-- Generates the barcode
|
||||
|
||||
SELECT CONCAT(
|
||||
LPAD(IFNULL(auction,0), 3, 0),
|
||||
LPAD(IFNULL(klo, 99), 2, 0),
|
||||
LPAD(DAYOFYEAR(fec), 3, 0),
|
||||
COALESCE(agj, RIGHT(batchNumber,7), id))
|
||||
INTO vBarcode
|
||||
FROM ekt
|
||||
WHERE id = vSelf;
|
||||
|
||||
-- Rewrites the kop parameter
|
||||
|
||||
IF vKop IS NULL THEN
|
||||
|
@ -46,10 +34,9 @@ BEGIN
|
|||
|
||||
-- Refresh EKT
|
||||
|
||||
UPDATE ekt SET
|
||||
barcode = vBarcode
|
||||
,kop = vKop
|
||||
,putOrderFk = vTruncatePutOrder
|
||||
UPDATE ekt
|
||||
SET kop = vKop,
|
||||
putOrderFk = vTruncatePutOrder
|
||||
WHERE id = vSelf;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -2,7 +2,6 @@ CREATE OR REPLACE DEFINER=`root`@`localhost`
|
|||
SQL SECURITY DEFINER
|
||||
VIEW `edi`.`ektRecent`
|
||||
AS SELECT `e`.`id` AS `id`,
|
||||
`e`.`barcode` AS `barcode`,
|
||||
`e`.`entryYear` AS `entryYear`,
|
||||
`e`.`batchNumber` AS `batchNumber`,
|
||||
`e`.`deliveryNumber` AS `deliveryNumber`,
|
||||
|
|
|
@ -30,6 +30,7 @@ BEGIN
|
|||
tmp.ticketComponentPrice,
|
||||
tmp.ticketComponent,
|
||||
tmp.ticketLot,
|
||||
tmp.zoneGetShipped;
|
||||
tmp.zoneGetShipped,
|
||||
tmp.item;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -6,19 +6,6 @@ BEGIN
|
|||
* identificando y notificando los asientos descuadrados
|
||||
* y ajustando los saldos en caso necesario.
|
||||
*/
|
||||
INSERT INTO mail (receiver, subject, body)
|
||||
SELECT 'cau@verdnatura.es',
|
||||
'Asientos descuadrados',
|
||||
GROUP_CONCAT(CONCAT(' Asiento: ', ASIEN, ' - Importe:', recon) SEPARATOR ' | \n')
|
||||
FROM (
|
||||
SELECT ASIEN,
|
||||
SUM(IFNULL(ROUND(Eurodebe, 2), 0)) - SUM(IFNULL(ROUND(EUROHABER, 2), 0)) recon
|
||||
FROM XDiario
|
||||
WHERE NOT enlazado
|
||||
GROUP BY ASIEN
|
||||
HAVING ABS(SUM(IFNULL(ROUND(Eurodebe, 2), 0)) - SUM(IFNULL(ROUND(EUROHABER, 2), 0))) > 0.01
|
||||
) sub
|
||||
HAVING COUNT(*);
|
||||
|
||||
UPDATE XDiario xd
|
||||
JOIN (
|
||||
|
|
|
@ -16,9 +16,9 @@ BEGIN
|
|||
|
||||
SET @order = 0;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.newSaleList;
|
||||
DROP TEMPORARY TABLE IF EXISTS tNewSaleList;
|
||||
|
||||
CREATE TEMPORARY TABLE tmp.newSaleList
|
||||
CREATE TEMPORARY TABLE tNewSaleList
|
||||
SELECT id as saleFk, @order := @order + 1 as orden
|
||||
FROM vn.sale
|
||||
WHERE ticketFk = vTargetTicketFk
|
||||
|
@ -28,7 +28,8 @@ BEGIN
|
|||
SELECT ns.saleFk, sc.componentFk, sc.value
|
||||
FROM vn.saleComponent sc
|
||||
JOIN tmp.saleList s ON s.saleFk = sc.saleFk
|
||||
JOIN tmp.newSaleList ns ON ns.orden = s.orden;
|
||||
JOIN tNewSaleList ns ON ns.orden = s.orden;
|
||||
|
||||
DROP TEMPORARY TABLE tNewSaleList;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -8,7 +8,6 @@ BEGIN
|
|||
*/
|
||||
DECLARE vTaxRowLimit INT;
|
||||
DECLARE vLines INT;
|
||||
DECLARE vHasDistinctTransactions INT;
|
||||
|
||||
SELECT taxRowLimit INTO vTaxRowLimit FROM invoiceInConfig;
|
||||
|
||||
|
@ -20,17 +19,5 @@ BEGIN
|
|||
IF vLines >= vTaxRowLimit THEN
|
||||
CALL util.throw (CONCAT('The maximum number of lines is ', vTaxRowLimit));
|
||||
END IF;
|
||||
|
||||
SELECT COUNT(DISTINCT transactionTypeSageFk) INTO vHasDistinctTransactions
|
||||
FROM invoiceIn ii
|
||||
JOIN invoiceInTax iit ON iit.invoiceInFk = ii.id
|
||||
JOIN invoiceInSerial iis ON iis.code = ii.serial
|
||||
WHERE ii.id = vInvoiceInFk
|
||||
AND iis.taxAreaFk = 'CEE'
|
||||
AND transactionTypeSageFk;
|
||||
|
||||
IF vHasDistinctTransactions > 1 THEN
|
||||
CALL util.throw ('This invoice does not allow different types of transactions');
|
||||
END IF;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -13,6 +13,19 @@ BEGIN
|
|||
* @param vBookEntry Id de asiento, si es NULL se genera uno nuevo
|
||||
*/
|
||||
DECLARE vFiscalYear INT;
|
||||
DECLARE vHasDistinctTransactions INT;
|
||||
|
||||
SELECT COUNT(DISTINCT transactionTypeSageFk) INTO vHasDistinctTransactions
|
||||
FROM invoiceIn ii
|
||||
JOIN invoiceInTax iit ON iit.invoiceInFk = ii.id
|
||||
JOIN invoiceInSerial iis ON iis.code = ii.serial
|
||||
WHERE ii.id = vSelf
|
||||
AND iis.taxAreaFk = 'CEE'
|
||||
AND transactionTypeSageFk;
|
||||
|
||||
IF vHasDistinctTransactions > 1 THEN
|
||||
CALL util.throw ('This invoice does not allow different types of transactions');
|
||||
END IF;
|
||||
|
||||
CREATE OR REPLACE TEMPORARY TABLE tInvoiceIn
|
||||
ENGINE = MEMORY
|
||||
|
|
|
@ -59,5 +59,7 @@ BEGIN
|
|||
WHERE p.pickingOrder BETWEEN vPickingOrderFrom AND vPickingOrderTo
|
||||
AND p.sectorFk = vSectorFk
|
||||
ORDER BY p.pickingOrder;
|
||||
|
||||
DROP TEMPORARY TABLE tmp.stockMisfit;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -76,5 +76,7 @@ BEGIN
|
|||
i.quantity amount
|
||||
FROM tmp.itemAtp i
|
||||
HAVING amount != 0;
|
||||
|
||||
DROP TEMPORARY TABLE tmp.itemAtp;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -15,14 +15,13 @@ BEGIN
|
|||
* @param vDated Fecha
|
||||
* @param vShowType Mostrar tipos
|
||||
*/
|
||||
DECLARE vCalcFk INT;
|
||||
DECLARE vAvailableCalcFk INT;
|
||||
DECLARE vVisibleCalcFk INT;
|
||||
DECLARE vTypeFk INT;
|
||||
DECLARE vPriority INT DEFAULT 1;
|
||||
|
||||
CALL cache.available_refresh(vCalcFk, FALSE, vWarehouseFk, vDated);
|
||||
|
||||
-- Añadido temporalmente para que no se cuelgue la db
|
||||
SET vShowType = TRUE;
|
||||
CALL cache.available_refresh(vAvailableCalcFk, FALSE, vWarehouseFk, vDated);
|
||||
CALL cache.visible_refresh(vVisibleCalcFk, FALSE, vWarehouseFk);
|
||||
|
||||
WITH itemTags AS (
|
||||
SELECT i.id,
|
||||
|
@ -65,21 +64,21 @@ BEGIN
|
|||
WHEN b.groupingMode = 'packing' THEN b.packing
|
||||
ELSE 1
|
||||
END AS minQuantity,
|
||||
iss.visible located,
|
||||
v.visible located,
|
||||
b.price2
|
||||
FROM vn.item i
|
||||
JOIN cache.available a ON a.item_id = i.id
|
||||
AND a.calc_id = vCalcFk
|
||||
AND a.calc_id = vAvailableCalcFk
|
||||
LEFT JOIN cache.visible v ON v.item_id = i.id
|
||||
AND v.calc_id = vVisibleCalcFk
|
||||
LEFT JOIN cache.last_buy lb ON lb.item_id = i.id
|
||||
AND lb.warehouse_id = vWarehouseFk
|
||||
LEFT JOIN vn.itemProposal ip ON ip.mateFk = i.id
|
||||
AND ip.itemFk = vSelf
|
||||
LEFT JOIN vn.itemTag it ON it.itemFk = i.id
|
||||
AND it.priority = vPriority
|
||||
LEFT JOIN vn.tag t ON t.id = it.tagFk
|
||||
LEFT JOIN cache.last_buy lb ON lb.item_id = i.id
|
||||
AND lb.warehouse_id = vWarehouseFk
|
||||
LEFT JOIN vn.buy b ON b.id = lb.buy_id
|
||||
LEFT JOIN vn.itemShelvingStock iss ON iss.itemFk = i.id
|
||||
AND iss.warehouseFk = vWarehouseFk
|
||||
JOIN itemTags its
|
||||
WHERE a.available > 0
|
||||
AND (i.typeFk = its.typeFk OR NOT vShowType)
|
||||
|
|
|
@ -104,5 +104,6 @@ BEGIN
|
|||
) sub;
|
||||
DROP TEMPORARY TABLE tmp.whiteTicket;
|
||||
DROP TEMPORARY TABLE tmp.sectorTypeTicket;
|
||||
DROP TEMPORARY TABLE tmp.productionBuffer;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -8,7 +8,7 @@ BEGIN
|
|||
JOIN vn.component c ON c.id = sc.componentFk
|
||||
JOIN vn.componentType ct ON ct.id = c.typeFk
|
||||
WHERE s.ticketFk = vTicketFk
|
||||
AND ct.`type` = 'otros';
|
||||
AND ct.code = 'other';
|
||||
|
||||
UPDATE vn.sale s
|
||||
JOIN (
|
||||
|
|
|
@ -22,40 +22,42 @@ proc: BEGIN
|
|||
CALL util.throw('parkingNotExist');
|
||||
LEAVE proc;
|
||||
END IF;
|
||||
|
||||
IF vParam REGEXP '^[0-9]+$' THEN
|
||||
-- Se comprueba si es una preparación previa
|
||||
SELECT COUNT(*) INTO vIsSaleGroup
|
||||
FROM vn.saleGroup sg
|
||||
WHERE sg.id = vParam;
|
||||
|
||||
-- Se comprueba si es una preparación previa
|
||||
SELECT COUNT(*) INTO vIsSaleGroup
|
||||
FROM vn.saleGroup sg
|
||||
WHERE sg.id = vParam;
|
||||
IF vIsSaleGroup THEN
|
||||
CALL vn.saleGroup_setParking(vParam, vParkingFk);
|
||||
LEAVE proc;
|
||||
END IF;
|
||||
|
||||
IF vIsSaleGroup THEN
|
||||
CALL vn.saleGroup_setParking(vParam, vParkingFk);
|
||||
LEAVE proc;
|
||||
-- Se comprueba si es un ticket
|
||||
SELECT COUNT(*) INTO vIsTicket
|
||||
FROM vn.ticket t
|
||||
WHERE t.id = vParam
|
||||
AND t.shipped >= TIMESTAMPADD(WEEK,-1,util.VN_CURDATE());
|
||||
|
||||
IF vIsTicket THEN
|
||||
CALL vn.ticket_setParking(vParam, vParkingFk);
|
||||
LEAVE proc;
|
||||
END IF;
|
||||
|
||||
-- Se comprueba si es una coleccion de tickets
|
||||
SELECT COUNT(*) INTO vIsCollection
|
||||
FROM vn.collection c
|
||||
WHERE c.id = vParam
|
||||
AND c.created >= TIMESTAMPADD(WEEK,-1,util.VN_CURDATE());
|
||||
|
||||
IF vIsCollection THEN
|
||||
CALL vn.collection_setParking(vParam, vParkingFk);
|
||||
LEAVE proc;
|
||||
END IF;
|
||||
ELSE
|
||||
-- Por descarte, se considera una matrícula
|
||||
CALL vn.shelving_setParking(vParam, vParkingFk);
|
||||
END IF;
|
||||
|
||||
-- Se comprueba si es un ticket
|
||||
SELECT COUNT(*) INTO vIsTicket
|
||||
FROM vn.ticket t
|
||||
WHERE t.id = vParam
|
||||
AND t.shipped >= TIMESTAMPADD(WEEK,-1,util.VN_CURDATE());
|
||||
|
||||
IF vIsTicket THEN
|
||||
CALL vn.ticket_setParking(vParam, vParkingFk);
|
||||
LEAVE proc;
|
||||
END IF;
|
||||
|
||||
-- Se comprueba si es una coleccion de tickets
|
||||
SELECT COUNT(*) INTO vIsCollection
|
||||
FROM vn.collection c
|
||||
WHERE c.id = vParam
|
||||
AND c.created >= TIMESTAMPADD(WEEK,-1,util.VN_CURDATE());
|
||||
|
||||
IF vIsCollection THEN
|
||||
CALL vn.collection_setParking(vParam, vParkingFk);
|
||||
LEAVE proc;
|
||||
END IF;
|
||||
|
||||
-- Por descarte, se considera una matrícula
|
||||
CALL vn.shelving_setParking(vParam, vParkingFk);
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -3,14 +3,14 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_DelayTruck`(
|
|||
BEGIN
|
||||
DECLARE done INT DEFAULT FALSE;
|
||||
DECLARE vTicketFk INT;
|
||||
DECLARE cur1 CURSOR FOR SELECT ticketFk FROM tmp.ticket;
|
||||
DECLARE cur1 CURSOR FOR SELECT ticketFk FROM tTicket;
|
||||
|
||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
|
||||
|
||||
CALL vn.productionControl(vWarehouserFk,0) ;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticket;
|
||||
CREATE TEMPORARY TABLE tmp.ticket
|
||||
DROP TEMPORARY TABLE IF EXISTS tTicket;
|
||||
CREATE TEMPORARY TABLE tTicket
|
||||
SELECT ticketFk
|
||||
FROM tmp.productionBuffer
|
||||
JOIN alertLevel al ON al.code = 'FREE'
|
||||
|
@ -31,5 +31,6 @@ BEGIN
|
|||
END LOOP;
|
||||
|
||||
CLOSE cur1;
|
||||
DROP TEMPORARY TABLE tTicket, tmp.productionBuffer;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -65,6 +65,8 @@ BEGIN
|
|||
IF (vZoneFk IS NULL OR vZoneFk = 0) AND vIsRequiredZone THEN
|
||||
CALL util.throw ('NOT_ZONE_WITH_THIS_PARAMETERS');
|
||||
END IF;
|
||||
|
||||
DROP TEMPORARY TABLE tmp.zoneGetShipped;
|
||||
END IF;
|
||||
|
||||
INSERT INTO ticket (
|
||||
|
|
|
@ -20,7 +20,8 @@ BEGIN
|
|||
JOIN itemCategory ic ON ic.id = tp.categoryFk
|
||||
JOIN saleComponent sc ON sc.saleFk = s.id
|
||||
JOIN component c ON c.id = sc.componentFk
|
||||
JOIN componentType ct ON ct.id = c.typeFk AND ct.id = 1
|
||||
JOIN componentType ct ON ct.id = c.typeFk
|
||||
AND ct.code = 'cost'
|
||||
WHERE t.shipped BETWEEN vShippedFrom AND vShippedTo
|
||||
AND ic.merchandise;
|
||||
|
||||
|
|
|
@ -213,6 +213,6 @@ BEGIN
|
|||
END;
|
||||
END LOOP;
|
||||
CLOSE rsTicket;
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.time;
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.time, tmp.zoneGetLanded;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -66,7 +66,7 @@ BEGIN
|
|||
JOIN vn.componentType ct ON ct.id = c.typeFk
|
||||
JOIN vn.sale s ON s.id = sc.saleFk
|
||||
JOIN tmp.ticket t ON t.ticketFk = s.ticketFk
|
||||
WHERE ct.code = 'FREIGHT'
|
||||
WHERE ct.code = 'freight'
|
||||
GROUP BY t.ticketFk) sb ON sb.ticketFk = tf.ticketFk
|
||||
SET tf.freight = sb.freight;
|
||||
|
||||
|
@ -88,7 +88,7 @@ BEGIN
|
|||
|
||||
-- Margin
|
||||
UPDATE tmp.ticketFloramondo tf
|
||||
JOIN (SELECT SUM(IF(ct.code = 'COST',sc.value, 0)) cost,
|
||||
JOIN (SELECT SUM(IF(ct.code = 'cost',sc.value, 0)) cost,
|
||||
SUM(IF(ct.isMargin, sc.value, 0)) margin,
|
||||
t.ticketFk
|
||||
FROM vn.saleComponent sc
|
||||
|
|
|
@ -44,7 +44,6 @@ BEGIN
|
|||
WHERE s.ticketFk = vTicketFk;
|
||||
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.saleGroup
|
||||
(PRIMARY KEY (itemPackingTypeFk))
|
||||
ENGINE = MEMORY
|
||||
SELECT itemPackingTypeFk, SUM(litros) totalLitros
|
||||
FROM tmp.sale
|
||||
|
@ -56,8 +55,7 @@ BEGIN
|
|||
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.ticketIPT (
|
||||
ticketFk INT,
|
||||
itemPackingTypeFk VARCHAR(1),
|
||||
PRIMARY KEY (ticketFk)
|
||||
itemPackingTypeFk VARCHAR(1)
|
||||
) ENGINE = MEMORY;
|
||||
|
||||
CASE vPackingTypesToSplit
|
||||
|
|
|
@ -103,6 +103,7 @@ BEGIN
|
|||
DROP TEMPORARY TABLE
|
||||
geoCollision,
|
||||
tmp.zone,
|
||||
tmp.zoneNodes;
|
||||
tmp.zoneNodes,
|
||||
tmp.zoneOption;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -19,4 +19,4 @@ FROM (
|
|||
)
|
||||
JOIN `vn`.`componentType` `ct` ON(`ct`.`id` = `c`.`typeFk`)
|
||||
)
|
||||
WHERE `ct`.`type` = 'coste'
|
||||
WHERE `ct`.`code` = 'cost'
|
||||
|
|
|
@ -16,6 +16,6 @@ FROM (
|
|||
)
|
||||
JOIN `vn`.`componentType` `ct` ON(
|
||||
`ct`.`id` = `c`.`typeFk`
|
||||
AND `ct`.`type` = 'agencia'
|
||||
AND `ct`.`code` = 'freight'
|
||||
)
|
||||
)
|
||||
|
|
|
@ -9,14 +9,9 @@ AS SELECT `it`.`id` AS `tipo_id`,
|
|||
`it`.`workerFk` AS `Id_Trabajador`,
|
||||
`it`.`life` AS `life`,
|
||||
`it`.`isPackaging` AS `isPackaging`,
|
||||
`it`.`density` AS `density`,
|
||||
`it`.`isInventory` AS `inventory`,
|
||||
`it`.`created` AS `odbc_date`,
|
||||
`it`.`making` AS `confeccion`,
|
||||
`it`.`temperatureFk` AS `Temperatura`,
|
||||
`it`.`promo` AS `promo`,
|
||||
`it`.`maneuver` AS `maneuver`,
|
||||
`it`.`target` AS `target`,
|
||||
`it`.`topMargin` AS `top_margin`,
|
||||
`it`.`profit` AS `profit`
|
||||
`it`.`promo` AS `promo`
|
||||
FROM `vn`.`itemType` `it`
|
||||
|
|
|
@ -2,7 +2,6 @@ CREATE OR REPLACE DEFINER=`root`@`localhost`
|
|||
SQL SECURITY DEFINER
|
||||
VIEW `vn2008`.`buy_edi`
|
||||
AS SELECT `t`.`id` AS `id`,
|
||||
`t`.`barcode` AS `barcode`,
|
||||
`t`.`entryYear` AS `entry_year`,
|
||||
`t`.`deliveryNumber` AS `delivery_number`,
|
||||
`t`.`fec` AS `fec`,
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
-- Place your SQL code here
|
||||
|
||||
USE vn;
|
||||
|
||||
ALTER TABLE vn.roadmap ADD kmStart mediumint(9) DEFAULT NULL NULL;
|
||||
ALTER TABLE vn.roadmap ADD kmEnd mediumint(9) DEFAULT NULL NULL;
|
||||
ALTER TABLE vn.roadmap ADD started DATETIME NULL;
|
||||
ALTER TABLE vn.roadmap ADD finished DATETIME NULL;
|
|
@ -0,0 +1,9 @@
|
|||
ALTER TABLE vn.componentType
|
||||
CHANGE code code varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL NULL AFTER id;
|
||||
ALTER TABLE vn.componentType
|
||||
CHANGE `type` name varchar(45) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NOT NULL;
|
||||
UPDATE IGNORE vn.componentType
|
||||
SET code = LOWER(code);
|
||||
UPDATE IGNORE vn.componentType
|
||||
SET code = 'other'
|
||||
WHERE id = 12;
|
|
@ -0,0 +1,6 @@
|
|||
ALTER TABLE vn.itemType
|
||||
CHANGE maneuver maneuver__ double DEFAULT 0.21 NOT NULL COMMENT '@deprecated 2024-07-01 refs #7418',
|
||||
CHANGE target target__ double DEFAULT 0.15 NOT NULL COMMENT '@deprecated 2024-07-01 refs #7418',
|
||||
CHANGE topMargin topMargin__ double DEFAULT 0.3 NOT NULL COMMENT '@deprecated 2024-07-01 refs #7418',
|
||||
CHANGE profit profit__ double DEFAULT 0.02 NOT NULL COMMENT '@deprecated 2024-07-01 refs #7418',
|
||||
CHANGE density density__ double DEFAULT 167 NOT NULL COMMENT '@deprecated 2024-07-01 refs #7418 Almacena el valor por defecto de la densidad en kg/m3 para el calculo de los portes aereos, en articulos se guarda la correcta';
|
|
@ -0,0 +1,4 @@
|
|||
ALTER TABLE account.mailAliasAccount
|
||||
ADD editorFk INT(10) UNSIGNED DEFAULT NULL,
|
||||
ADD CONSTRAINT mailAliasAccount_editorFk FOREIGN KEY (editorFk)
|
||||
REFERENCES account.`user`(id);
|
|
@ -0,0 +1,62 @@
|
|||
module.exports = Self => {
|
||||
Self.remoteMethod('getPalletMatchState', {
|
||||
description: 'Get list of pallet from truckFk with true or false if state is matched',
|
||||
accessType: 'WRITE',
|
||||
accepts: [{
|
||||
arg: 'truckFk',
|
||||
type: 'number',
|
||||
required: true,
|
||||
description: 'The truckFk id'
|
||||
},
|
||||
{
|
||||
arg: 'state',
|
||||
type: 'string',
|
||||
required: true,
|
||||
description: 'State code'
|
||||
}],
|
||||
returns: {
|
||||
type: 'object',
|
||||
root: true
|
||||
},
|
||||
http: {
|
||||
path: `/getPalletMatchState`,
|
||||
verb: 'GET'
|
||||
}
|
||||
});
|
||||
|
||||
Self.getPalletMatchState = async(truckFk, state, options) => {
|
||||
const myOptions = {};
|
||||
|
||||
if (typeof options == 'object')
|
||||
Object.assign(myOptions, options);
|
||||
|
||||
const result = await Self.rawSql(`
|
||||
WITH tPallet AS(
|
||||
SELECT ep.id pallet, e.id expedition, e.stateTypeFk
|
||||
FROM vn.expeditionPallet ep
|
||||
JOIN vn.expeditionScan es ON es.palletFk = ep.id
|
||||
JOIN expedition e ON e.id = es.expeditionFk
|
||||
WHERE ep.truckFk = ?
|
||||
),totalPalletExpedition AS(
|
||||
SELECT t.*, COUNT(expedition) totalPalletExpedition
|
||||
FROM tPallet t
|
||||
GROUP BY expedition
|
||||
),totalPalletExpeditionCode AS(
|
||||
SELECT t.*, COUNT(expedition) totalPalletExpeditionCode
|
||||
FROM tPallet t
|
||||
JOIN vn.expeditionStateType est ON est.id = t.stateTypeFk
|
||||
WHERE code = ?
|
||||
GROUP BY expedition
|
||||
)
|
||||
SELECT t.pallet,
|
||||
tpe.totalPalletExpedition = tpec.totalPalletExpeditionCode hasMatchStateCode
|
||||
FROM tPallet t
|
||||
LEFT JOIN totalPalletExpedition tpe ON tpe.expedition = t.expedition
|
||||
LEFT JOIN totalPalletExpeditionCode tpec ON tpec.expedition = t.expedition
|
||||
GROUP BY t.pallet;`,
|
||||
[truckFk, state],
|
||||
myOptions);
|
||||
|
||||
return result;
|
||||
};
|
||||
};
|
|
@ -0,0 +1,12 @@
|
|||
|
||||
const {models} = require('vn-loopback/server/server');
|
||||
|
||||
describe('roadMapStop getPalletMatchState()', () => {
|
||||
it('should return list of pallet with true or false if state is matched', async() => {
|
||||
const truckFk = 1;
|
||||
const state = 'ON DELIVERY';
|
||||
const result = await models.RoadmapStop.getPalletMatchState(truckFk, state);
|
||||
|
||||
expect(result[0].hasMatchStateCode).toBe(1);
|
||||
});
|
||||
});
|
|
@ -3,7 +3,7 @@
|
|||
"base": "VnModel",
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "roadmap"
|
||||
"table": "roadmap"
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
|
@ -41,10 +41,22 @@
|
|||
},
|
||||
"driverName": {
|
||||
"type": "string"
|
||||
},
|
||||
"kmStart": {
|
||||
"type": "number"
|
||||
},
|
||||
"kmEnd": {
|
||||
"type": "number"
|
||||
},
|
||||
"started": {
|
||||
"type": "date"
|
||||
},
|
||||
"finished": {
|
||||
"type": "date"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
"worker": {
|
||||
"relations": {
|
||||
"worker": {
|
||||
"type": "belongsTo",
|
||||
"model": "Worker",
|
||||
"foreignKey": "id"
|
||||
|
@ -57,7 +69,7 @@
|
|||
"roadmapStop": {
|
||||
"type": "hasMany",
|
||||
"model": "RoadmapStop",
|
||||
"foreignKey": "roadmapFk"
|
||||
"foreignKey": "roadMapFk"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = Self => {
|
||||
require('../methods/roadmapStop/getPalletMatchState')(Self);
|
||||
};
|
|
@ -3,7 +3,7 @@
|
|||
"base": "VnModel",
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "roadmapStop"
|
||||
"table": "roadmapStop"
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
|
@ -28,16 +28,16 @@
|
|||
"type": "number"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
"roadmap": {
|
||||
"relations": {
|
||||
"roadmap": {
|
||||
"type": "belongsTo",
|
||||
"model": "Roadmap",
|
||||
"foreignKey": "roadmapFk"
|
||||
},
|
||||
"address": {
|
||||
"type": "belongsTo",
|
||||
"model": "Address",
|
||||
"model": "RoadmapAddress",
|
||||
"foreignKey": "addressFk"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -12,7 +12,7 @@
|
|||
"type": "number",
|
||||
"description": "Identifier"
|
||||
},
|
||||
"type": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"isBase":{
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
ng-repeat="saleComponent in sale.components track by saleComponent.componentFk"
|
||||
class="components">
|
||||
<td>
|
||||
{{::saleComponent.component.componentType.type}}
|
||||
{{::saleComponent.component.componentType.name}}
|
||||
</td>
|
||||
<td>
|
||||
{{::saleComponent.component.name}}
|
||||
|
|
|
@ -20,7 +20,7 @@ class Controller extends Section {
|
|||
include: {
|
||||
relation: 'componentType',
|
||||
scope: {
|
||||
fields: ['type', 'isBase']
|
||||
fields: ['name', 'isBase']
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,29 +26,33 @@
|
|||
},
|
||||
"labelerFk": {
|
||||
"type": "number"
|
||||
},
|
||||
"isOnReservationMode": {
|
||||
"type": "boolean",
|
||||
"required": true
|
||||
}
|
||||
},
|
||||
},
|
||||
"relations": {
|
||||
"sector": {
|
||||
"type": "belongsTo",
|
||||
"model": "Sector",
|
||||
"foreignKey": "sectorFk"
|
||||
},
|
||||
"sector": {
|
||||
"type": "belongsTo",
|
||||
"model": "Sector",
|
||||
"foreignKey": "sectorFk"
|
||||
},
|
||||
"train": {
|
||||
"type": "belongsTo",
|
||||
"model": "Train",
|
||||
"foreignKey": "trainFk"
|
||||
},
|
||||
"type": "belongsTo",
|
||||
"model": "Train",
|
||||
"foreignKey": "trainFk"
|
||||
},
|
||||
"printer": {
|
||||
"type": "belongsTo",
|
||||
"model": "Printer",
|
||||
"foreignKey": "labelerFk"
|
||||
},
|
||||
"type": "belongsTo",
|
||||
"model": "Printer",
|
||||
"foreignKey": "labelerFk"
|
||||
},
|
||||
"itemPackingType": {
|
||||
"type": "belongsTo",
|
||||
"model": "ItemPackingType",
|
||||
"foreignKey": "itemPackingTypeFk",
|
||||
"type": "belongsTo",
|
||||
"model": "ItemPackingType",
|
||||
"foreignKey": "itemPackingTypeFk",
|
||||
"primaryKey": "code"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "salix-back",
|
||||
"version": "24.28.0",
|
||||
"version": "24.30.0",
|
||||
"author": "Verdnatura Levante SL",
|
||||
"description": "Salix backend",
|
||||
"license": "GPL-3.0",
|
||||
|
|
|
@ -1,43 +1,42 @@
|
|||
SELECT
|
||||
s.id,
|
||||
s.itemFk,
|
||||
s.concept,
|
||||
s.quantity,
|
||||
s.price,
|
||||
s.price - SUM(IF(ctr.id = 6, sc.value, 0)) netPrice,
|
||||
s.discount,
|
||||
i.size,
|
||||
i.stems,
|
||||
i.category,
|
||||
it.id itemTypeId,
|
||||
o.code AS origin,
|
||||
i.inkFk,
|
||||
s.ticketFk,
|
||||
tcl.code vatType,
|
||||
ib.ediBotanic botanical,
|
||||
i.tag5,
|
||||
i.value5,
|
||||
i.tag6,
|
||||
i.value6,
|
||||
i.tag7,
|
||||
i.value7
|
||||
FROM vn.sale s
|
||||
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
|
||||
LEFT JOIN component cr ON cr.id = sc.componentFk
|
||||
LEFT JOIN componentType ctr ON ctr.id = cr.typeFk
|
||||
LEFT JOIN item i ON i.id = s.itemFk
|
||||
LEFT JOIN ticket t ON t.id = s.ticketFk
|
||||
LEFT JOIN origin o ON o.id = i.originFk
|
||||
LEFT JOIN country c ON c.id = o.countryFk
|
||||
LEFT JOIN supplier sp ON sp.id = t.companyFk
|
||||
LEFT JOIN itemType it ON it.id = i.typeFk
|
||||
LEFT JOIN itemCategory ic ON ic.id = it.categoryFk
|
||||
LEFT JOIN itemTaxCountry itc ON itc.itemFk = i.id
|
||||
AND itc.countryFk = sp.countryFk
|
||||
LEFT JOIN taxClass tcl ON tcl.id = itc.taxClassFk
|
||||
LEFT JOIN itemBotanicalWithGenus ib ON ib.itemFk = i.id
|
||||
AND ic.code = 'plant'
|
||||
AND ib.ediBotanic IS NOT NULL
|
||||
WHERE s.ticketFk = ?
|
||||
GROUP BY s.id
|
||||
ORDER BY (it.isPackaging), s.concept, s.itemFk
|
||||
SELECT s.id,
|
||||
s.itemFk,
|
||||
s.concept,
|
||||
s.quantity,
|
||||
s.price,
|
||||
s.price - SUM(IF(ctr.code = 'freight', sc.value, 0)) netPrice,
|
||||
s.discount,
|
||||
i.size,
|
||||
i.stems,
|
||||
i.category,
|
||||
it.id itemTypeId,
|
||||
o.code origin,
|
||||
i.inkFk,
|
||||
s.ticketFk,
|
||||
tcl.code vatType,
|
||||
ib.ediBotanic botanical,
|
||||
i.tag5,
|
||||
i.value5,
|
||||
i.tag6,
|
||||
i.value6,
|
||||
i.tag7,
|
||||
i.value7
|
||||
FROM vn.sale s
|
||||
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
|
||||
LEFT JOIN component cr ON cr.id = sc.componentFk
|
||||
LEFT JOIN componentType ctr ON ctr.id = cr.typeFk
|
||||
LEFT JOIN item i ON i.id = s.itemFk
|
||||
LEFT JOIN ticket t ON t.id = s.ticketFk
|
||||
LEFT JOIN origin o ON o.id = i.originFk
|
||||
LEFT JOIN country c ON c.id = o.countryFk
|
||||
LEFT JOIN supplier sp ON sp.id = t.companyFk
|
||||
LEFT JOIN itemType it ON it.id = i.typeFk
|
||||
LEFT JOIN itemCategory ic ON ic.id = it.categoryFk
|
||||
LEFT JOIN itemTaxCountry itc ON itc.itemFk = i.id
|
||||
AND itc.countryFk = sp.countryFk
|
||||
LEFT JOIN taxClass tcl ON tcl.id = itc.taxClassFk
|
||||
LEFT JOIN itemBotanicalWithGenus ib ON ib.itemFk = i.id
|
||||
AND ic.code = 'plant'
|
||||
AND ib.ediBotanic IS NOT NULL
|
||||
WHERE s.ticketFk = ?
|
||||
GROUP BY s.id
|
||||
ORDER BY (it.isPackaging), s.concept, s.itemFk
|
Loading…
Reference in New Issue