feat: refs #6869 add back
gitea/salix/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Jorge Penadés 2024-11-11 09:09:51 +01:00
parent a254cb19cd
commit 5c054fe0d3
3 changed files with 52 additions and 30 deletions

View File

@ -1,30 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelving_get`(IN vSelf VARCHAR(8))
BEGIN
/**
* Lista artículos de itemshelving
*
* @param vSelf matrícula del carro
**/
SELECT ish.itemFk item,
i.name,
i.longName,
i.size,
ish.visible,
ish.packing,
ish.grouping,
p.code,
ish.id,
s.priority,
ish.isChecked,
ic.url,
ish.available,
ish.buyFk
FROM itemShelving ish
JOIN item i ON i.id = ish.itemFk
JOIN shelving s ON vSelf = s.code COLLATE utf8_unicode_ci
LEFT JOIN parking p ON s.parkingFk = p.id
JOIN hedera.imageConfig ic
WHERE ish.shelvingFk COLLATE utf8_unicode_ci = vSelf;
END$$
DELIMITER ;

View File

@ -0,0 +1,51 @@
module.exports = Self => {
Self.remoteMethod('getItems', {
description: 'shelving item list',
accessType: 'READ',
accepts: [{
arg: 'code',
type: 'string',
required: true,
description: 'Shelving code'
}],
returns: {
type: 'object',
root: true
},
http: {
path: `/getItems`,
verb: 'GET'
}
});
Self.getItems = async(code, options) => {
const models = Self.app.models;
const myOptions = {};
if (typeof options == 'object')
Object.assign(myOptions, options);
const shelving = await models.Shelving.findOne({
fields: ['priority', 'parkingFk'],
include: {
relation: 'parking',
scope: {fields: ['code']}
},
where: {code}
}, myOptions);
const itemShelvings = await Self.find({
fields: ['itemFk', 'visible', 'packing', 'grouping', 'isChecked', 'available', 'buyFk'],
include: {
relation: 'item',
scope: {fields: ['name', 'longName', 'size']}
},
where: {shelvingFk: code}
}, myOptions);
return {
code: shelving.parking().code,
priority: shelving.priority,
itemShelvings,
};
// Add image from hedera.imageConfig
};
};

View File

@ -5,4 +5,5 @@ module.exports = Self => {
require('../methods/item-shelving/getAlternative')(Self);
require('../methods/item-shelving/updateFromSale')(Self);
require('../methods/item-shelving/getListItemNewer')(Self);
require('../methods/item-shelving/getItems')(Self);
};