refs #6276 itemShelving_return
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Jorge Penadés 2023-12-01 10:14:32 +01:00
parent 30b63f577f
commit f2ab44bb8f
1 changed files with 10 additions and 7 deletions

View File

@ -8,7 +8,7 @@ module.exports = Self => {
required: true,
}],
returns: {
type: 'object',
type: ['object'],
root: true
},
http: {
@ -50,8 +50,7 @@ module.exports = Self => {
let itemShelvings = await models.ItemShelving.find(filterItemShelvings, myOptions);
let alternatives = await models.ItemShelving.rawSql('CALL vn.itemShelving_getAlternatives(?)', [shelvingFk]);
console.log(alternatives);
const alternatives = await models.ItemShelving.rawSql('CALL vn.itemShelving_getAlternatives(?)', [shelvingFk]);
if (itemShelvings) {
itemShelvings = itemShelvings.map(itemShelving => {
@ -59,19 +58,23 @@ module.exports = Self => {
const shelving = itemShelving.shelving();
const parking = shelving ? shelving.parking() : null;
const carros = alternatives.filter(el => el.item == itemShelving.itemFk);
return {
id: itemShelving.id,
item: itemShelving.itemFk,
description: item ? item.longName || `${item.name} ${item.size}` : '',
visible: itemShelving.visible,
longName: item ? item.longName || `${item.name} ${item.size}` : '',
quantity: itemShelving.visible,
stickers: Math.ceil(itemShelving.visible / itemShelving.packing),
packing: itemShelving.packing,
grouping: itemShelving.grouping,
code: parking ? parking.code : '',
id: itemShelving.id,
priority: shelving ? shelving.priority : 0,
isChecked: itemShelving.isChecked
isChecked: itemShelving.isChecked,
carros
};
});
}
return itemShelvings;
};
};