Merge pull request '#6238 add travelKgPercentage table and model' (!2626) from 6238-warmfix-addTable into test
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
Reviewed-on: #2626 Reviewed-by: Alex Moreno <alexm@verdnatura.es>
This commit is contained in:
commit
2d38c370a9
|
@ -0,0 +1,18 @@
|
||||||
|
-- Place your SQL code here
|
||||||
|
CREATE TABLE IF NOT EXISTS travelKgPercentage (
|
||||||
|
value INT(3) PRIMARY KEY,
|
||||||
|
className VARCHAR(50)
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT IGNORE INTO travelKgPercentage (value, className)
|
||||||
|
VALUES
|
||||||
|
(80, 'primary'),
|
||||||
|
(100, 'alert');
|
||||||
|
|
||||||
|
INSERT IGNORE INTO salix.ACL
|
||||||
|
SET model = 'TravelKgPercentage',
|
||||||
|
property = '*',
|
||||||
|
accessType = 'READ',
|
||||||
|
permission = 'ALLOW',
|
||||||
|
principalType = 'ROLE',
|
||||||
|
principalId = 'employee';
|
|
@ -138,7 +138,19 @@ module.exports = Self => {
|
||||||
b.stickers *
|
b.stickers *
|
||||||
IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000
|
IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000
|
||||||
) as DECIMAL(10,0)
|
) 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
|
FROM travel t
|
||||||
LEFT JOIN supplier s ON s.id = t.cargoSupplierFk
|
LEFT JOIN supplier s ON s.id = t.cargoSupplierFk
|
||||||
LEFT JOIN entry e ON e.travelFk = t.id
|
LEFT JOIN entry e ON e.travelFk = t.id
|
||||||
|
|
|
@ -11,6 +11,9 @@
|
||||||
"Thermograph": {
|
"Thermograph": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
"TravelKgPercentage": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
"TravelThermograph": {
|
"TravelThermograph": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
{
|
||||||
|
"name": "TravelKgPercentage",
|
||||||
|
"base": "VnModel",
|
||||||
|
"mixins": {
|
||||||
|
"Loggable": true
|
||||||
|
},
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "travelKgPercentage"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"value": {
|
||||||
|
"type": "number",
|
||||||
|
"id": true
|
||||||
|
},
|
||||||
|
"className": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue