Compare commits
9 Commits
79172ef288
...
9b2bb4be0e
Author | SHA1 | Date |
---|---|---|
Juanjo Breso | 9b2bb4be0e | |
Guillermo Bonet | afe2669b27 | |
Guillermo Bonet | 36c8a8db0f | |
Guillermo Bonet | 8f6303e851 | |
Ivan Mas | 2291a92a43 | |
Ivan Mas | e7055e2428 | |
Guillermo Bonet | 8dd4ac9119 | |
Alex Moreno | 6f0038e4cc | |
Ivan Mas | 9899efab97 |
|
@ -24,7 +24,7 @@ node {
|
||||||
FROM_GIT = env.JOB_NAME.startsWith('gitea/')
|
FROM_GIT = env.JOB_NAME.startsWith('gitea/')
|
||||||
RUN_TESTS = !PROTECTED_BRANCH && FROM_GIT
|
RUN_TESTS = !PROTECTED_BRANCH && FROM_GIT
|
||||||
RUN_BUILD = PROTECTED_BRANCH && FROM_GIT
|
RUN_BUILD = PROTECTED_BRANCH && FROM_GIT
|
||||||
env.DEBUG = 'strong-remoting:shared-method'
|
// env.DEBUG = 'strong-remoting:shared-method'
|
||||||
// https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#using-environment-variables
|
// https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#using-environment-variables
|
||||||
echo "NODE_NAME: ${env.NODE_NAME}"
|
echo "NODE_NAME: ${env.NODE_NAME}"
|
||||||
echo "WORKSPACE: ${env.WORKSPACE}"
|
echo "WORKSPACE: ${env.WORKSPACE}"
|
||||||
|
|
|
@ -19,10 +19,10 @@ BEGIN
|
||||||
AND a.hasWeightVolumetric
|
AND a.hasWeightVolumetric
|
||||||
LIMIT 1;
|
LIMIT 1;
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.buysToCheck;
|
DROP TEMPORARY TABLE tmp.buysToCheck;
|
||||||
|
|
||||||
IF hasVolumetricAgency THEN
|
IF hasVolumetricAgency THEN
|
||||||
CALL util.throw('Some purchase line has an item without size or weight per stem in the volumetric agency.');
|
CALL util.throw('Item lacks size/weight in purchase line at agency');
|
||||||
END IF;
|
END IF;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
|
@ -9,6 +9,14 @@ BEGIN
|
||||||
DECLARE vCurrencyName VARCHAR(25);
|
DECLARE vCurrencyName VARCHAR(25);
|
||||||
DECLARE vComission INT;
|
DECLARE vComission INT;
|
||||||
|
|
||||||
|
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||||
|
BEGIN
|
||||||
|
ROLLBACK;
|
||||||
|
RESIGNAL;
|
||||||
|
END;
|
||||||
|
|
||||||
|
START TRANSACTION;
|
||||||
|
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tmp.recalcEntryCommision
|
CREATE OR REPLACE TEMPORARY TABLE tmp.recalcEntryCommision
|
||||||
SELECT e.id
|
SELECT e.id
|
||||||
FROM vn.entry e
|
FROM vn.entry e
|
||||||
|
@ -28,12 +36,15 @@ BEGIN
|
||||||
WHERE id = vCurrency;
|
WHERE id = vCurrency;
|
||||||
|
|
||||||
CALL entry_recalc();
|
CALL entry_recalc();
|
||||||
|
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
SELECT util.notification_send(
|
SELECT util.notification_send(
|
||||||
'entry-update-comission',
|
'entry-update-comission',
|
||||||
JSON_OBJECT('currencyName', vCurrencyName, 'referenceCurrent', vComission),
|
JSON_OBJECT('currencyName', vCurrencyName, 'referenceCurrent', vComission),
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tmp.recalcEntryCommision;
|
DROP TEMPORARY TABLE tmp.recalcEntryCommision;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -1,74 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`recipe_Cook`(vItemFk INT, vBunchesQuantity INT, vDate DATE)
|
|
||||||
BEGIN
|
|
||||||
|
|
||||||
DECLARE vCalc INT;
|
|
||||||
DECLARE vWarehouseFk INT DEFAULT 1; -- Silla FV
|
|
||||||
|
|
||||||
SET @element := '';
|
|
||||||
SET @counter := 0;
|
|
||||||
|
|
||||||
CALL cache.available_refresh(vCalc, FALSE, vWarehouseFk, vDate);
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.recipeCook;
|
|
||||||
|
|
||||||
CREATE TEMPORARY TABLE tmp.recipeCook
|
|
||||||
SELECT *,
|
|
||||||
@counter := IF(@element = element COLLATE utf8_general_ci , @counter + 1, 1) as counter,
|
|
||||||
@element := element COLLATE utf8_general_ci
|
|
||||||
FROM
|
|
||||||
(
|
|
||||||
SELECT i.id itemFk,
|
|
||||||
CONCAT(i.longName, ' (ref: ',i.id,')') longName,
|
|
||||||
i.size,
|
|
||||||
i.inkFk,
|
|
||||||
a.available,
|
|
||||||
r.element,
|
|
||||||
vBunchesQuantity * r.quantity as quantity,
|
|
||||||
r.itemFk as bunchItemFk,
|
|
||||||
IFNULL((i.inkFk = r.inkFk ) ,0)
|
|
||||||
+ IFNULL((i.size = r.size) ,0)
|
|
||||||
+ IFNULL((i.name LIKE CONCAT('%',r.name,'%')) ,0)
|
|
||||||
+ IFNULL((i.longName LIKE CONCAT('%',r.longName,'%')),0)
|
|
||||||
+ IFNULL((i.typeFk = r.typeFk),0) as matches,
|
|
||||||
i.typeFk,
|
|
||||||
rl.previousSelected
|
|
||||||
FROM vn.recipe r
|
|
||||||
JOIN vn.item i ON (IFNULL(i.name LIKE CONCAT('%',r.name,'%'), 0)
|
|
||||||
OR IFNULL(i.longName LIKE CONCAT('%',r.longName,'%'),0))
|
|
||||||
OR i.typeFk <=> r.typeFk
|
|
||||||
JOIN cache.available a ON a.item_id = i.id AND a.calc_id = vCalc
|
|
||||||
LEFT JOIN (SELECT recipe_ItemFk, element as log_element, selected_ItemFk, count(*) as previousSelected
|
|
||||||
FROM vn.recipe_log
|
|
||||||
GROUP BY recipe_ItemFk, element, selected_ItemFk) rl ON rl.recipe_ItemFk = r.itemFk
|
|
||||||
AND rl.log_element = r.element
|
|
||||||
AND rl.selected_ItemFk = i.id
|
|
||||||
WHERE r.itemFk = vItemFk
|
|
||||||
AND a.available > vBunchesQuantity * r.quantity
|
|
||||||
UNION ALL
|
|
||||||
SELECT 100 itemFk,
|
|
||||||
CONCAT('? ',r.element,' ',IFNULL(r.size,''),' ',IFNULL(r.inkFk,'')) as longName,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
0,
|
|
||||||
r.element,
|
|
||||||
vBunchesQuantity * r.quantity as quantity,
|
|
||||||
r.itemFk as bunchItemFk,
|
|
||||||
-1 as matches,
|
|
||||||
r.typeFk,
|
|
||||||
NULL
|
|
||||||
FROM vn.recipe r
|
|
||||||
WHERE r.itemFk = vItemFk
|
|
||||||
GROUP BY r.element
|
|
||||||
) sub
|
|
||||||
|
|
||||||
ORDER BY element, matches DESC, previousSelected DESC;
|
|
||||||
|
|
||||||
SELECT *
|
|
||||||
FROM tmp.recipeCook
|
|
||||||
WHERE counter < 6
|
|
||||||
OR itemFk = 100
|
|
||||||
;
|
|
||||||
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
Loading…
Reference in New Issue