Compare commits

...

28 Commits

Author SHA1 Message Date
Carlos Satorres 25ce685116 Merge branch 'dev' into 5824-fixUpsertFixedPrice
gitea/salix/pipeline/head This commit looks good Details
2023-07-19 04:36:51 +00:00
Carlos Satorres 9c746dd6c2 Merge pull request '5066-vehicleSorted' (!1467) from 5066-vehicleSorted into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #1467
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
Reviewed-by: Juan Ferrer <juan@verdnatura.es>
2023-07-18 15:21:54 +00:00
Carlos Satorres 36db2ee883 Merge branch 'dev' into 5066-vehicleSorted
gitea/salix/pipeline/head This commit looks good Details
2023-07-18 15:05:56 +00:00
Guillermo Bonet b285c3e37a Merge pull request 'refs #5819 Added param to call zone_getLeaves' (!1667) from 5819-zone_getLeaves into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #1667
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
2023-07-18 06:40:50 +00:00
Guillermo Bonet 3c013110d3 refs #5819 Changed structure sql
gitea/salix/pipeline/head This commit looks good Details
2023-07-18 07:32:45 +02:00
Carlos Satorres b2b335326e Merge branch 'dev' into 5066-vehicleSorted
gitea/salix/pipeline/head There was a failure building this commit Details
2023-07-14 11:49:26 +00:00
Guillermo Bonet 765a84e2eb refs #5819 Added param to call zone_getLeaves
gitea/salix/pipeline/head There was a failure building this commit Details
2023-07-14 07:27:04 +02:00
Carlos Satorres eff46c1cec refs #5066 e2e fix, vnConfig
gitea/salix/pipeline/head This commit looks good Details
2023-06-26 07:43:36 +02:00
Carlos Satorres dcbe8c5f7a refs #5066 quit if
gitea/salix/pipeline/head This commit looks good Details
2023-06-26 06:28:35 +02:00
Carlos Satorres abfe012a78 Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 5066-vehicleSorted 2023-06-26 06:12:22 +02:00
Carlos Satorres fa10070675 Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 5066-vehicleSorted
gitea/salix/pipeline/head This commit looks good Details
2023-06-20 14:04:38 +02:00
Carlos Satorres cc27d1fa97 refs #5066 fix vehicle res.data
gitea/salix/pipeline/head There was a failure building this commit Details
2023-06-07 08:30:37 +02:00
Carlos Satorres 738b04af4c Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 5066-vehicleSorted 2023-06-07 08:15:50 +02:00
Carlos Satorres d18137bce0 refs #5066 not dense
gitea/salix/pipeline/head This commit looks good Details
2023-05-31 10:20:13 +02:00
Carlos Satorres cfe0ba7a77 Merge branch '5066-vehicleSorted' of https://gitea.verdnatura.es/verdnatura/salix into 5066-vehicleSorted
gitea/salix/pipeline/head This commit looks good Details
2023-05-31 10:04:36 +02:00
Carlos Satorres dfebb3b307 refs #5066 sorted without CONCAT, order=false 2023-05-31 10:04:34 +02:00
Carlos Satorres 813c4ede00 Merge branch 'dev' into 5066-vehicleSorted
gitea/salix/pipeline/head This commit looks good Details
2023-05-30 10:22:49 +00:00
Carlos Satorres eaffd61579 Merge branch '5066-vehicleSorted' of https://gitea.verdnatura.es/verdnatura/salix into 5066-vehicleSorted
gitea/salix/pipeline/head This commit looks good Details
2023-05-30 12:21:47 +02:00
Carlos Satorres 0661bf8fa9 refs #5066 remake sql without ROW_ORDER 2023-05-30 12:21:44 +02:00
Alex Moreno 8fff3989e7 Merge branch 'dev' into 5066-vehicleSorted
gitea/salix/pipeline/head This commit looks good Details
2023-05-30 06:30:48 +00:00
Carlos Satorres 3423ce612c refs #5066 e2e fixs, change name sorted
gitea/salix/pipeline/head This commit looks good Details
2023-05-29 13:49:32 +02:00
Carlos Satorres d8e7c2700a refs #5066 fix autocomplete
gitea/salix/pipeline/head This commit looks good Details
2023-05-29 12:42:27 +02:00
Carlos Satorres 91edc09057 refs #5066 move sql
gitea/salix/pipeline/head This commit looks good Details
2023-05-29 10:24:37 +02:00
Carlos Satorres 2e83d91006 Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 5066-vehicleSorted 2023-05-29 10:24:19 +02:00
Carlos Satorres 237c83c6f5 refs #5066 getVehicleSorted small mod
gitea/salix/pipeline/head This commit looks good Details
2023-04-20 10:20:15 +02:00
Carlos Satorres 89a3ef5f8d Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 5066-vehicleSorted
gitea/salix/pipeline/head There was a failure building this commit Details
2023-04-20 09:30:20 +02:00
Carlos Satorres 16fdfa00fd refs #5066 e2e solve
gitea/salix/pipeline/head There was a failure building this commit Details
2023-04-20 09:09:48 +02:00
Carlos Satorres b45b0ff826 refs #5066 copy project from the other
gitea/salix/pipeline/head There was a failure building this commit Details
2023-04-20 08:23:46 +02:00
7 changed files with 120 additions and 51 deletions

View File

@ -0,0 +1,3 @@
INSERT INTO `salix`.`ACL` (`model`,`property`,`accessType`,`permission`,`principalId`)
VALUES
('Vehicle','sorted','WRITE','ALLOW','employee');

View File

@ -77831,7 +77831,7 @@ BEGIN
LEAVE cur1Loop;
END IF;
CALL zone_getLeaves2(vZoneFk, NULL, NULL);
CALL zone_getLeaves(vZoneFk, NULL, NULL, TRUE);
myLoop: LOOP
SET vGeoFk = NULL;
@ -77844,7 +77844,7 @@ BEGIN
LEAVE myLoop;
END IF;
CALL zone_getLeaves2(vZoneFk, vGeoFk, NULL);
CALL zone_getLeaves(vZoneFk, vGeoFk, NULL, TRUE);
UPDATE tmp.zoneNodes
SET isChecked = TRUE
WHERE geoFk = vGeoFk;
@ -78130,55 +78130,58 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getLeaves`(vSelf INT, vParentFk INT, vSearch VARCHAR(255))
BEGIN
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`zone_getLeaves`(
vSelf INT,
vParentFk INT,
vSearch VARCHAR(255),
vHasInsert BOOL
)
BEGIN
/**
* Devuelve las ubicaciones incluidas en la ruta y que sean hijos de parentFk.
* @param vSelf Id de la zona
* @param vParentFk Id del geo a calcular
* @param vSearch cadena a buscar
* @param vSearch Cadena a buscar
* @param vHasInsert Indica si inserta en tmp.zoneNodes
* Optional @table tmp.zoneNodes(geoFk, name, parentFk, sons, isChecked, zoneFk)
*/
DECLARE vIsNumber BOOL;
DECLARE vIsSearch BOOL DEFAULT vSearch IS NOT NULL AND vSearch != '';
DECLARE vIsSearch BOOL DEFAULT vSearch IS NOT NULL AND vSearch <> '';
DROP TEMPORARY TABLE IF EXISTS tNodes;
CREATE TEMPORARY TABLE tNodes
CREATE OR REPLACE TEMPORARY TABLE tNodes
(UNIQUE (id))
ENGINE = MEMORY
SELECT id
FROM zoneGeo
SELECT id
FROM zoneGeo
LIMIT 0;
IF vIsSearch THEN
SET vIsNumber = vSearch REGEXP '^[0-9]+$';
INSERT INTO tNodes
SELECT id
SELECT id
FROM zoneGeo
WHERE (vIsNumber AND `name` = vSearch)
OR (!vIsNumber AND `name` LIKE CONCAT('%', vSearch, '%'))
LIMIT 1000;
ELSEIF vParentFk IS NULL THEN
INSERT INTO tNodes
SELECT geoFk
SELECT geoFk
FROM zoneIncluded
WHERE zoneFk = vSelf;
END IF;
IF vParentFk IS NULL THEN
DROP TEMPORARY TABLE IF EXISTS tChilds;
CREATE TEMPORARY TABLE tChilds
CREATE OR REPLACE TEMPORARY TABLE tChilds
(INDEX(id))
ENGINE = MEMORY
SELECT id
FROM tNodes;
SELECT id FROM tNodes;
DROP TEMPORARY TABLE IF EXISTS tParents;
CREATE TEMPORARY TABLE tParents
CREATE OR REPLACE TEMPORARY TABLE tParents
(INDEX(id))
ENGINE = MEMORY
SELECT id
FROM zoneGeo
LIMIT 0;
SELECT id FROM zoneGeo LIMIT 0;
myLoop: LOOP
DELETE FROM tParents;
@ -78186,43 +78189,67 @@ BEGIN
SELECT parentFk id
FROM zoneGeo g
JOIN tChilds c ON c.id = g.id
WHERE g.parentFk IS NOT NULL;
WHERE g.parentFk IS NOT NULL;
INSERT IGNORE INTO tNodes
SELECT id
FROM tParents;
IF ROW_COUNT() = 0 THEN
SELECT id FROM tParents;
IF NOT ROW_COUNT() THEN
LEAVE myLoop;
END IF;
DELETE FROM tChilds;
INSERT INTO tChilds
SELECT id
FROM tParents;
SELECT id FROM tParents;
END LOOP;
DROP TEMPORARY TABLE tChilds, tParents;
END IF;
IF !vIsSearch THEN
IF NOT vIsSearch THEN
INSERT IGNORE INTO tNodes
SELECT id
SELECT id
FROM zoneGeo
WHERE parentFk <=> vParentFk;
END IF;
SELECT g.id,
g.name,
g.parentFk,
g.sons,
isIncluded selected
FROM zoneGeo g
JOIN tNodes n ON n.id = g.id
LEFT JOIN zoneIncluded i ON i.geoFk = g.id AND i.zoneFk = vSelf
ORDER BY `depth`, selected DESC, name;
CREATE OR REPLACE TEMPORARY TABLE tZones
SELECT g.id,
g.name,
g.parentFk,
g.sons,
NOT g.sons OR `type` = 'country' isChecked,
i.isIncluded selected,
g.`depth`,
vSelf
FROM zoneGeo g
JOIN tNodes n ON n.id = g.id
LEFT JOIN zoneIncluded i ON i.geoFk = g.id
AND i.zoneFk = vSelf
ORDER BY g.`depth`, selected DESC, g.name;
DROP TEMPORARY TABLE tNodes;
IF vHasInsert THEN
INSERT IGNORE INTO tmp.zoneNodes(geoFk, name, parentFk, sons, isChecked, zoneFk)
SELECT id,
name,
parentFk,
sons,
isChecked,
vSelf
FROM tZones
WHERE selected
OR (selected IS NULL AND vParentFk IS NOT NULL);
ELSE
SELECT id,
name,
parentFk,
sons,
selected
FROM tZones
ORDER BY `depth`, selected DESC, name;
END IF;
DROP TEMPORARY TABLE tNodes, tZones;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@ -78540,7 +78567,7 @@ BEGIN
INDEX(geoFk))
ENGINE = MEMORY;
CALL zone_getLeaves2(vSelf, NULL , NULL);
CALL zone_getLeaves(vSelf, NULL , NULL, TRUE);
UPDATE tmp.zoneNodes zn
SET isChecked = 0
@ -78553,7 +78580,7 @@ BEGIN
WHERE NOT isChecked
LIMIT 1;
CALL zone_getLeaves2(vSelf, vGeoFk, NULL);
CALL zone_getLeaves(vSelf, vGeoFk, NULL, TRUE);
UPDATE tmp.zoneNodes
SET isChecked = TRUE
WHERE geoFk = vGeoFk;

View File

@ -0,0 +1,27 @@
module.exports = Self => {
Self.remoteMethod('sorted', {
description: 'Sort the vehicles by warehouse',
accessType: 'WRITE',
accepts: [{
arg: 'warehouseFk',
type: 'number'
}],
returns: {
type: ['object'],
root: true
},
http: {
path: `/sorted`,
verb: `POST`
}
});
Self.sorted = async warehouseFk => {
return Self.rawSql(`
SELECT v.id, v.warehouseFk, v.numberPlate, w.name
FROM vehicle v
JOIN warehouse w ON w.id = v.warehouseFk
ORDER BY v.warehouseFk = ? DESC, w.id, v.numberPlate ASC;
`, [warehouseFk]);
};
};

View File

@ -0,0 +1,3 @@
module.exports = Self => {
require('../methods/vehicle/sorted')(Self);
};

View File

@ -23,19 +23,21 @@
</tpl-item>
</vn-autocomplete>
<vn-autocomplete
label="Vehicle"
ng-model="$ctrl.route.vehicleFk"
url="Vehicles"
data="$ctrl.vehicles"
show-field="numberPlate"
value-field="id"
label="Vehicle"
order="false"
vn-name="vehicle">
<tpl-item>{{::numberPlate}} - {{::name}}</tpl-item>
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal>
<vn-date-picker
label="Created"
ng-model="$ctrl.route.created"
vn-name="created">
vn-name="created">
</vn-date-picker>
<vn-autocomplete
ng-model="$ctrl.route.agencyModeFk"

View File

@ -2,6 +2,13 @@ import ngModule from '../module';
import Section from 'salix/components/section';
class Controller extends Section {
$onInit() {
this.$http.post(`Vehicles/sorted`, {warehouseFk: this.vnConfig.warehouseFk})
.then(res => {
this.vehicles = res.data;
});
}
onSubmit() {
this.$.watcher.submit().then(() =>
this.card.reload()

View File

@ -38,7 +38,7 @@ module.exports = Self => {
Object.assign(myOptions, options);
const [res] = await Self.rawSql(
`CALL zone_getLeaves(?, ?, ?)`,
`CALL zone_getLeaves(?, ?, ?, FALSE)`,
[id, parentId, search],
myOptions
);