#7965 - unifyProblems #2990

Merged
jon merged 20 commits from 7965-unifyProblems into dev 2025-02-05 06:51:55 +00:00
2 changed files with 18 additions and 5 deletions
Showing only changes of commit bb1695eac6 - Show all commits

View File

@ -55,7 +55,8 @@ BEGIN
SUM(IFNULL(ts.hasItemDelay,0)) hasItemDelay,
SUM(IFNULL(ts.hasItemLost,0)) hasItemLost,
IF(FIND_IN_SET('hasComponentLack', s.problem), TRUE, FALSE) hasComponentLack,
SUM(IFNULL(ts.hasRounding,0)) hasRounding
SUM(IFNULL(ts.hasRounding,0)) hasRounding,
0 totalProblems
FROM tmp.ticket tt
JOIN ticket t ON t.id = tt.ticketFk
JOIN client c ON c.id = t.clientFk
@ -64,5 +65,20 @@ BEGIN
LEFT JOIN zoneClosure zc ON zc.zoneFk = t.zoneFk
AND zc.dated = util.VN_CURDATE()
GROUP BY t.id;
UPDATE tmp.ticketProblems
SET totalProblems = (
(isFreezed) +
(hasHighRisk) +
(hasTicketRequest) +
(!isTaxDataChecked) +
(hasComponentLack) +
(hasItemDelay IS NOT NULL) +
jgallego marked this conversation as resolved Outdated

es posible que el if sobre si true es true, asignau directament no?

es posible que el if sobre si true es true, asignau directament no?
(isTooLittle) +
(hasItemLost IS NOT NULL) +
(hasRounding IS NOT NULL) +
(hasItemShortage IS NOT NULL) +
(isVip)
);
END$$
DELIMITER ;

View File

@ -325,20 +325,17 @@ module.exports = Self => {
let condition;
let hasProblem;
let range;
let hasWhere;
switch (args.problems) {
case true:
condition = `or`;
hasProblem = true;
range = {neq: null};
hasWhere = true;
break;
case false:
condition = `and`;
hasProblem = null;
range = null;
hasWhere = true;
break;
}
@ -347,7 +344,7 @@ module.exports = Self => {
{'tp.isFreezed': hasProblem},
{'tp.hasRisk': hasProblem},
{'tp.hasTicketRequest': hasProblem},
{'tp.hasItemShortage': range},
{'tp.hasItemShortage': hasProblem},
{'tp.hasRounding': hasProblem}
]};