feat(monitor): Sort by amount of problems on a ticket list
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
559ff95fd7
commit
8623f914c7
|
@ -0,0 +1,47 @@
|
||||||
|
drop procedure `vn`.`ticket_getProblems`;
|
||||||
|
|
||||||
|
DELIMITER $$
|
||||||
|
$$
|
||||||
|
create
|
||||||
|
definer = root@`%` procedure `vn`.`ticket_getProblems`(IN vIsTodayRelative tinyint(1))
|
||||||
|
BEGIN
|
||||||
|
/**
|
||||||
|
* Calcula los problemas para un conjunto de tickets.
|
||||||
|
* Agrupados por ticket
|
||||||
|
*
|
||||||
|
* @table tmp.sale_getProblems(ticketFk, clientFk, warehouseFk, shipped) Identificadores de los tickets a calcular
|
||||||
|
* @return tmp.ticket_problems
|
||||||
|
*/
|
||||||
|
CALL sale_getProblems(vIsTodayRelative);
|
||||||
|
|
||||||
|
DROP TEMPORARY TABLE IF EXISTS tmp.ticket_problems;
|
||||||
|
CREATE TEMPORARY TABLE tmp.ticket_problems
|
||||||
|
(INDEX (ticketFk))
|
||||||
|
ENGINE = MEMORY
|
||||||
|
SELECT
|
||||||
|
ticketFk,
|
||||||
|
MAX(p.isFreezed) AS isFreezed,
|
||||||
|
MAX(p.risk) AS risk,
|
||||||
|
MAX(p.hasTicketRequest) AS hasTicketRequest,
|
||||||
|
MIN(p.isAvailable) AS isAvailable,
|
||||||
|
MAX(p.itemShortage) AS itemShortage,
|
||||||
|
MIN(p.isTaxDataChecked) AS isTaxDataChecked,
|
||||||
|
MAX(p.hasComponentLack) AS hasComponentLack,
|
||||||
|
0 AS totalProblems
|
||||||
|
FROM tmp.sale_problems p
|
||||||
|
GROUP BY ticketFk;
|
||||||
|
|
||||||
|
UPDATE tmp.ticket_problems tp
|
||||||
|
SET tp.totalProblems = (
|
||||||
|
(tp.isFreezed) +
|
||||||
|
IF(tp.risk, TRUE, FALSE) +
|
||||||
|
(tp.hasTicketRequest) +
|
||||||
|
(tp.isAvailable = 0) +
|
||||||
|
(tp.isTaxDataChecked = 0) +
|
||||||
|
(tp.hasComponentLack)
|
||||||
|
);
|
||||||
|
|
||||||
|
DROP TEMPORARY TABLE
|
||||||
|
tmp.sale_problems;
|
||||||
|
END;;$$
|
||||||
|
DELIMITER ;
|
|
@ -6,3 +6,4 @@ Delete selected elements: Eliminar los elementos seleccionados
|
||||||
All the selected elements will be deleted. Are you sure you want to continue?: Todos los elementos seleccionados serán eliminados. ¿Seguro que quieres continuar?
|
All the selected elements will be deleted. Are you sure you want to continue?: Todos los elementos seleccionados serán eliminados. ¿Seguro que quieres continuar?
|
||||||
Component lack: Faltan componentes
|
Component lack: Faltan componentes
|
||||||
Minimize/Maximize: Minimizar/Maximizar
|
Minimize/Maximize: Minimizar/Maximizar
|
||||||
|
Problems: Problemas
|
|
@ -33,7 +33,7 @@
|
||||||
<vn-table model="model">
|
<vn-table model="model">
|
||||||
<vn-thead>
|
<vn-thead>
|
||||||
<vn-tr>
|
<vn-tr>
|
||||||
<vn-th class="icon-field"></vn-th>
|
<vn-th field="totalProblems">Problems</vn-th>
|
||||||
<vn-th field="nickname">Client</vn-th>
|
<vn-th field="nickname">Client</vn-th>
|
||||||
<vn-th field="salesPersonFk" class="expendable" shrink>Salesperson</vn-th>
|
<vn-th field="salesPersonFk" class="expendable" shrink>Salesperson</vn-th>
|
||||||
<vn-th field="shipped" shrink-date>Date</vn-th>
|
<vn-th field="shipped" shrink-date>Date</vn-th>
|
||||||
|
|
Loading…
Reference in New Issue