Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 5331-monitor.tickets_actualizarFiltro
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
commit
92aed3eac1
|
@ -8,7 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
## [2312.01] - 2023-04-06
|
## [2312.01] - 2023-04-06
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
-
|
- (Monitor tickets) Muestra un icono al lado de la zona, si el ticket es frágil y se envía por agencia
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
-
|
-
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
ALTER TABLE `vn`.`itemType` ADD isFragile tinyint(1) NULL;
|
||||||
|
ALTER TABLE `vn`.`itemType` MODIFY COLUMN isFragile tinyint(1) DEFAULT 0 NOT NULL;
|
||||||
|
|
||||||
|
UPDATE `vn`.`itemType`
|
||||||
|
SET isFragile = 1
|
||||||
|
WHERE code IN ('ZKA', 'ZKE');
|
||||||
|
|
||||||
|
UPDATE `vn`.`itemType`
|
||||||
|
SET isFragile = 1
|
||||||
|
WHERE id IN (SELECT it.id
|
||||||
|
FROM itemCategory ic
|
||||||
|
JOIN itemType it ON it.categoryFk = ic.id
|
||||||
|
WHERE ic.code = 'plant');
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
DROP PROCEDURE IF EXISTS `vn`.`ticket_getWarnings`;
|
||||||
|
|
||||||
|
DELIMITER $$
|
||||||
|
$$
|
||||||
|
CREATE PROCEDURE `vn`.`ticket_getWarnings`()
|
||||||
|
BEGIN
|
||||||
|
/**
|
||||||
|
* Calcula las adventencias para un conjunto de tickets.
|
||||||
|
* Agrupados por ticket
|
||||||
|
*
|
||||||
|
* @table tmp.sale_getWarnings(ticketFk) Identificadores de los tickets a calcular
|
||||||
|
* @return tmp.ticket_warnings
|
||||||
|
*/
|
||||||
|
DROP TEMPORARY TABLE IF EXISTS tmp.sale_warnings;
|
||||||
|
CREATE TEMPORARY TABLE tmp.sale_warnings (
|
||||||
|
ticketFk INT(11),
|
||||||
|
saleFk INT(11),
|
||||||
|
isFragile INTEGER(1) DEFAULT 0,
|
||||||
|
PRIMARY KEY (ticketFk, saleFk)
|
||||||
|
) ENGINE = MEMORY;
|
||||||
|
|
||||||
|
-- Frágil
|
||||||
|
INSERT INTO tmp.sale_warnings(ticketFk, saleFk, isFragile)
|
||||||
|
SELECT tt.ticketFk, s.id, TRUE
|
||||||
|
FROM tmp.sale_getWarnings tt
|
||||||
|
LEFT JOIN sale s ON s.ticketFk = tt.ticketFk
|
||||||
|
LEFT JOIN item i ON i.id = s.itemFk
|
||||||
|
LEFT JOIN itemType it ON it.id = i.typeFk
|
||||||
|
LEFT JOIN agencyMode am ON am.id = tt.agencyModeFk
|
||||||
|
LEFT JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk
|
||||||
|
WHERE dm.code IN ('AGENCY')
|
||||||
|
AND it.isFragile;
|
||||||
|
|
||||||
|
DROP TEMPORARY TABLE IF EXISTS tmp.ticket_warnings;
|
||||||
|
CREATE TEMPORARY TABLE tmp.ticket_warnings
|
||||||
|
(PRIMARY KEY (ticketFk))
|
||||||
|
ENGINE = MEMORY
|
||||||
|
SELECT
|
||||||
|
sw.ticketFk,
|
||||||
|
MAX(sw.isFragile) AS isFragile
|
||||||
|
FROM tmp.sale_warnings sw
|
||||||
|
GROUP BY sw.ticketFk;
|
||||||
|
|
||||||
|
DROP TEMPORARY TABLE
|
||||||
|
tmp.sale_warnings;
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -838,14 +838,14 @@ INSERT INTO `vn`.`temperature`(`code`, `name`, `description`)
|
||||||
('warm', 'Warm', 'Warm'),
|
('warm', 'Warm', 'Warm'),
|
||||||
('cool', 'Cool', 'Cool');
|
('cool', 'Cool', 'Cool');
|
||||||
|
|
||||||
INSERT INTO `vn`.`itemType`(`id`, `code`, `name`, `categoryFk`, `life`, `workerFk`, `isPackaging`, `temperatureFk`)
|
INSERT INTO `vn`.`itemType`(`id`, `code`, `name`, `categoryFk`, `life`, `workerFk`, `isPackaging`, `temperatureFk`, `isFragile`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 'CRI', 'Crisantemo', 2, 31, 35, 0, 'cool'),
|
(1, 'CRI', 'Crisantemo', 2, 31, 35, 0, 'cool', 0),
|
||||||
(2, 'ITG', 'Anthurium', 1, 31, 35, 0, 'cool'),
|
(2, 'ITG', 'Anthurium', 1, 31, 35, 0, 'cool', 1),
|
||||||
(3, 'WPN', 'Paniculata', 2, 31, 35, 0, 'cool'),
|
(3, 'WPN', 'Paniculata', 2, 31, 35, 0, 'cool', 0),
|
||||||
(4, 'PRT', 'Delivery ports', 3, NULL, 35, 1, 'warm'),
|
(4, 'PRT', 'Delivery ports', 3, NULL, 35, 1, 'warm', 0),
|
||||||
(5, 'CON', 'Container', 3, NULL, 35, 1, 'warm'),
|
(5, 'CON', 'Container', 3, NULL, 35, 1, 'warm', 0),
|
||||||
(6, 'ALS', 'Alstroemeria', 1, 31, 16, 0, 'warm');
|
(6, 'ALS', 'Alstroemeria', 1, 31, 16, 0, 'warm', 1);
|
||||||
|
|
||||||
INSERT INTO `vn`.`ink`(`id`, `name`, `picture`, `showOrder`, `hex`)
|
INSERT INTO `vn`.`ink`(`id`, `name`, `picture`, `showOrder`, `hex`)
|
||||||
VALUES
|
VALUES
|
||||||
|
|
|
@ -22,7 +22,8 @@ describe('claim', () => {
|
||||||
controller = $componentController('vnClaimDetail', {$element, $scope});
|
controller = $componentController('vnClaimDetail', {$element, $scope});
|
||||||
controller.claim = {
|
controller.claim = {
|
||||||
ticketFk: 1,
|
ticketFk: 1,
|
||||||
id: 2}
|
id: 2,
|
||||||
|
claimStateFk: 2}
|
||||||
;
|
;
|
||||||
controller.salesToClaim = [{saleFk: 1}, {saleFk: 2}];
|
controller.salesToClaim = [{saleFk: 1}, {saleFk: 2}];
|
||||||
controller.salesClaimed = [{id: 1, sale: {}}];
|
controller.salesClaimed = [{id: 1, sale: {}}];
|
||||||
|
|
|
@ -295,11 +295,26 @@ module.exports = Self => {
|
||||||
risk = t.debt + t.credit, totalProblems = totalProblems + 1
|
risk = t.debt + t.credit, totalProblems = totalProblems + 1
|
||||||
`);
|
`);
|
||||||
|
|
||||||
|
stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.sale_getWarnings');
|
||||||
|
|
||||||
stmt = new ParameterizedSQL(`
|
stmt = new ParameterizedSQL(`
|
||||||
SELECT t.*, tp.*,
|
CREATE TEMPORARY TABLE tmp.sale_getWarnings
|
||||||
((tp.risk) + cc.riskTolerance < 0) AS hasHighRisk
|
(INDEX (ticketFk, agencyModeFk))
|
||||||
|
ENGINE = MEMORY
|
||||||
|
SELECT f.id ticketFk, f.agencyModeFk
|
||||||
|
FROM tmp.filter f`);
|
||||||
|
stmts.push(stmt);
|
||||||
|
|
||||||
|
stmts.push('CALL ticket_getWarnings()');
|
||||||
|
|
||||||
|
stmt = new ParameterizedSQL(`
|
||||||
|
SELECT t.*,
|
||||||
|
tp.*,
|
||||||
|
((tp.risk) + cc.riskTolerance < 0) AS hasHighRisk,
|
||||||
|
tw.*
|
||||||
FROM tmp.tickets t
|
FROM tmp.tickets t
|
||||||
LEFT JOIN tmp.ticket_problems tp ON tp.ticketFk = t.id
|
LEFT JOIN tmp.ticket_problems tp ON tp.ticketFk = t.id
|
||||||
|
LEFT JOIN tmp.ticket_warnings tw ON tw.ticketFk = t.id
|
||||||
JOIN clientConfig cc`);
|
JOIN clientConfig cc`);
|
||||||
|
|
||||||
const hasProblems = args.problems;
|
const hasProblems = args.problems;
|
||||||
|
@ -404,6 +419,8 @@ module.exports = Self => {
|
||||||
tmp.filter,
|
tmp.filter,
|
||||||
tmp.ticket_problems,
|
tmp.ticket_problems,
|
||||||
tmp.sale_getProblems,
|
tmp.sale_getProblems,
|
||||||
|
tmp.sale_getWarnings,
|
||||||
|
tmp.ticket_warnings,
|
||||||
tmp.risk`);
|
tmp.risk`);
|
||||||
|
|
||||||
const sql = ParameterizedSQL.join(stmts, ';');
|
const sql = ParameterizedSQL.join(stmts, ';');
|
||||||
|
|
|
@ -12,4 +12,5 @@ Theoretical: Teórica
|
||||||
Practical: Práctica
|
Practical: Práctica
|
||||||
Preparation: Preparación
|
Preparation: Preparación
|
||||||
Auto-refresh: Auto-refresco
|
Auto-refresh: Auto-refresco
|
||||||
Toggle auto-refresh every 2 minutes: Conmuta el refresco automático cada 2 minutos
|
Toggle auto-refresh every 2 minutes: Conmuta el refresco automático cada 2 minutos
|
||||||
|
Is fragile: Es frágil
|
||||||
|
|
|
@ -19,13 +19,13 @@
|
||||||
<vn-horizontal class="header">
|
<vn-horizontal class="header">
|
||||||
<vn-one translate>
|
<vn-one translate>
|
||||||
Tickets monitor
|
Tickets monitor
|
||||||
</vn-one>
|
</vn-one>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-card>
|
<vn-card>
|
||||||
<smart-table
|
<smart-table
|
||||||
model="model"
|
model="model"
|
||||||
view-config-id="ticketsMonitor"
|
view-config-id="ticketsMonitor"
|
||||||
options="$ctrl.smartTableOptions"
|
options="$ctrl.smartTableOptions"
|
||||||
expr-builder="$ctrl.exprBuilder(param, value)">
|
expr-builder="$ctrl.exprBuilder(param, value)">
|
||||||
<slot-actions>
|
<slot-actions>
|
||||||
<vn-check
|
<vn-check
|
||||||
|
@ -68,6 +68,7 @@
|
||||||
<th field="stateFk">
|
<th field="stateFk">
|
||||||
<span translate>State</span>
|
<span translate>State</span>
|
||||||
</th>
|
</th>
|
||||||
|
<th field="isFragile"></th>
|
||||||
<th field="zoneFk">
|
<th field="zoneFk">
|
||||||
<span translate>Zone</span>
|
<span translate>Zone</span>
|
||||||
</th>
|
</th>
|
||||||
|
@ -80,7 +81,7 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr ng-repeat="ticket in model.data track by ticket.id"
|
<tr ng-repeat="ticket in model.data track by ticket.id"
|
||||||
vn-anchor="{
|
vn-anchor="{
|
||||||
state: 'ticket.card.summary',
|
state: 'ticket.card.summary',
|
||||||
params: {id: ticket.id},
|
params: {id: ticket.id},
|
||||||
target: '_blank'
|
target: '_blank'
|
||||||
}">
|
}">
|
||||||
|
@ -169,12 +170,20 @@
|
||||||
class="link">
|
class="link">
|
||||||
{{ticket.refFk}}
|
{{ticket.refFk}}
|
||||||
</span>
|
</span>
|
||||||
<span
|
<span
|
||||||
ng-show="!ticket.refFk"
|
ng-show="!ticket.refFk"
|
||||||
class="chip {{ticket.classColor}}">
|
class="chip {{ticket.classColor}}">
|
||||||
{{ticket.state}}
|
{{ticket.state}}
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
|
<td number>
|
||||||
|
<vn-icon
|
||||||
|
ng-show="ticket.isFragile"
|
||||||
|
translate-attr="{title: 'Is fragile'}"
|
||||||
|
class="bright"
|
||||||
|
icon="local_bar">
|
||||||
|
</vn-icon>
|
||||||
|
</td>
|
||||||
<td name="zone">
|
<td name="zone">
|
||||||
<span
|
<span
|
||||||
title="{{ticket.zoneName}}"
|
title="{{ticket.zoneName}}"
|
||||||
|
@ -191,8 +200,8 @@
|
||||||
<td actions>
|
<td actions>
|
||||||
<vn-icon-button
|
<vn-icon-button
|
||||||
vn-anchor="{
|
vn-anchor="{
|
||||||
state: 'ticket.card.sale',
|
state: 'ticket.card.sale',
|
||||||
params: {id: ticket.id},
|
params: {id: ticket.id},
|
||||||
target: '_blank'
|
target: '_blank'
|
||||||
}"
|
}"
|
||||||
vn-tooltip="Go to lines"
|
vn-tooltip="Go to lines"
|
||||||
|
@ -213,7 +222,7 @@
|
||||||
<vn-ticket-descriptor-popover
|
<vn-ticket-descriptor-popover
|
||||||
vn-id="ticketDescriptor">
|
vn-id="ticketDescriptor">
|
||||||
</vn-ticket-descriptor-popover>
|
</vn-ticket-descriptor-popover>
|
||||||
<vn-worker-descriptor-popover
|
<vn-worker-descriptor-popover
|
||||||
vn-id="workerDescriptor">
|
vn-id="workerDescriptor">
|
||||||
</vn-worker-descriptor-popover>
|
</vn-worker-descriptor-popover>
|
||||||
<vn-client-descriptor-popover
|
<vn-client-descriptor-popover
|
||||||
|
@ -236,22 +245,22 @@
|
||||||
ng-click="contextmenu.filterBySelection()">
|
ng-click="contextmenu.filterBySelection()">
|
||||||
Filter by selection
|
Filter by selection
|
||||||
</vn-item>
|
</vn-item>
|
||||||
<vn-item translate
|
<vn-item translate
|
||||||
ng-if="contextmenu.isFilterAllowed()"
|
ng-if="contextmenu.isFilterAllowed()"
|
||||||
ng-click="contextmenu.excludeSelection()">
|
ng-click="contextmenu.excludeSelection()">
|
||||||
Exclude selection
|
Exclude selection
|
||||||
</vn-item>
|
</vn-item>
|
||||||
<vn-item translate
|
<vn-item translate
|
||||||
ng-if="contextmenu.isFilterAllowed()"
|
ng-if="contextmenu.isFilterAllowed()"
|
||||||
ng-click="contextmenu.removeFilter()">
|
ng-click="contextmenu.removeFilter()">
|
||||||
Remove filter
|
Remove filter
|
||||||
</vn-item>
|
</vn-item>
|
||||||
<vn-item translate
|
<vn-item translate
|
||||||
ng-click="contextmenu.removeAllFilters()">
|
ng-click="contextmenu.removeAllFilters()">
|
||||||
Remove all filters
|
Remove all filters
|
||||||
</vn-item>
|
</vn-item>
|
||||||
<vn-item translate
|
<vn-item translate
|
||||||
ng-if="contextmenu.isActionAllowed()"
|
ng-if="contextmenu.isActionAllowed()"
|
||||||
ng-click="contextmenu.copyValue()">
|
ng-click="contextmenu.copyValue()">
|
||||||
Copy value
|
Copy value
|
||||||
</vn-item>
|
</vn-item>
|
||||||
|
|
Loading…
Reference in New Issue