feat: refs #6869 define model #3172
|
@ -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 ;
|
|
@ -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
|
||||
};
|
||||
};
|
|
@ -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);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue