feat: refs #8381 add initial and final temperature fields to entry model and queries #3354

Merged
jgallego merged 1 commits from 8381-entryTemperature into dev 2025-01-16 06:56:43 +00:00
4 changed files with 28 additions and 1 deletions

View File

@ -0,0 +1,3 @@
ALTER TABLE `vn`.`entry`
ADD COLUMN `initialTemperature` decimal(10,2) DEFAULT NULL COMMENT 'Temperatura de como lo recibimos del proveedor ej. en colombia',
ADD COLUMN `finalTemperature` decimal(10,2) DEFAULT NULL COMMENT 'Temperatura final de como llega a nuestras instalaciones';

View File

@ -119,6 +119,16 @@ module.exports = Self => {
arg: 'invoiceAmount',
type: 'number',
description: `The invoice amount`
},
{
arg: 'initialTemperature',
type: 'number',
description: 'Initial temperature value'
},
{
arg: 'finalTemperature',
type: 'number',
description: 'Final temperature value'
}
],
returns: {
@ -170,6 +180,10 @@ module.exports = Self => {
case 'invoiceInFk':
param = `e.${param}`;
return {[param]: value};
case 'initialTemperature':
return {'e.initialTemperature': {lte: value}};
jgallego marked this conversation as resolved
Review

Pot ser que estiguen al revés?

Pot ser que estiguen al revés?
Review

crec que es el que necessiten. Si tu busques algo que esta a 2 graus, pero el termografo han marcat a 1, també el vols vore perque es encara pitjor

crec que es el que necessiten. Si tu busques algo que esta a 2 graus, pero el termografo han marcat a 1, també el vols vore perque es encara pitjor
case 'finalTemperature':
return {'e.finalTemperature': {gte: value}};
}
});
filter = mergeFilters(ctx.args.filter, {where});
@ -204,6 +218,8 @@ module.exports = Self => {
e.gestDocFk,
e.invoiceInFk,
e.invoiceAmount,
e.initialTemperature,
e.finalTemperature,
t.landed,
s.name supplierName,
s.nickname supplierAlias,

View File

@ -68,6 +68,12 @@
},
"invoiceAmount": {
"type": "number"
},
"initialTemperature": {
"type": "number"
},
"finalTemperature": {
"type": "number"
}
},
"relations": {

View File

@ -41,7 +41,9 @@ module.exports = Self => {
* b.stickers)/1000000) AS DECIMAL(10,2)) m3,
TRUNCATE(SUM(b.stickers)/(COUNT( b.id) / COUNT( DISTINCT b.id)),0) hb,
CAST(SUM(b.freightValue*b.quantity) AS DECIMAL(10,2)) freightValue,
CAST(SUM(b.packageValue*b.quantity) AS DECIMAL(10,2)) packageValue
CAST(SUM(b.packageValue*b.quantity) AS DECIMAL(10,2)) packageValue,
e.initialTemperature,
e.finalTemperature
FROM vn.travel t
LEFT JOIN vn.entry e ON t.id = e.travelFk
LEFT JOIN vn.buy b ON b.entryFk = e.id