Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into dev
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Guillermo Bonet 2024-06-18 11:04:01 +02:00
commit a61c12a06d
4 changed files with 55 additions and 2 deletions

View File

@ -0,0 +1,17 @@
CREATE TABLE IF NOT EXISTS travelKgPercentage (
value INT(3) PRIMARY KEY,
className VARCHAR(50)
);
INSERT INTO travelKgPercentage (value, className)
VALUES
(80, 'primary'),
(100, 'alert');
INSERT INTO salix.ACL
SET model = 'TravelKgPercentage',
property = '*',
accessType = 'READ',
permission = 'ALLOW',
principalType = 'ROLE',
principalId = 'employee';

View File

@ -138,7 +138,19 @@ module.exports = Self => {
b.stickers *
IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000
) as DECIMAL(10,0)
) as volumeKg
) as volumeKg,
GREATEST(
CAST(SUM(b.weight * b.stickers) AS INT),
CAST(
SUM(vc.aerealVolumetricDensity *
b.stickers *
IF(pkg.volume,
pkg.volume,
pkg.width * pkg.depth * pkg.height
) / 1000000
) AS INT
)
/ t.kg * 100, 0) percentageKg
FROM travel t
LEFT JOIN supplier s ON s.id = t.cargoSupplierFk
LEFT JOIN entry e ON e.travelFk = t.id

View File

@ -11,6 +11,9 @@
"Thermograph": {
"dataSource": "vn"
},
"TravelKgPercentage": {
"dataSource": "vn"
},
"TravelThermograph": {
"dataSource": "vn"
},

View File

@ -0,0 +1,21 @@
{
"name": "TravelKgPercentage",
"base": "VnModel",
"mixins": {
"Loggable": true
},
"options": {
"mysql": {
"table": "travelKgPercentage"
}
},
"properties": {
"value": {
"type": "number",
"id": true
},
"className": {
"type": "string"
}
}
}