#6276 createNewWarehouse methods migrated from silex to salix #1850
|
@ -0,0 +1,58 @@
|
|||
module.exports = Self => {
|
||||
Self.remoteMethod('getSale', {
|
||||
description: 'Update the visible items',
|
||||
accessType: 'WRITE',
|
||||
accepts: [
|
||||
{
|
||||
arg: 'sectorCollectionFk',
|
||||
type: 'number',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
arg: 'sectorFk',
|
||||
type: 'number',
|
||||
required: true
|
||||
}
|
||||
],
|
||||
returns: {
|
||||
type: ['object'],
|
||||
root: true
|
||||
},
|
||||
http: {
|
||||
path: `/getSale`,
|
||||
verb: 'GET'
|
||||
},
|
||||
});
|
||||
|
||||
Self.getSale = async(sectorCollectionFk, sectorFk, options) => {
|
||||
const myOptions = {};
|
||||
|
||||
if (typeof options == 'object') Object.assign(myOptions, options);
|
||||
|
||||
const sales = await Self.rawSql('CALL vn.sectorCollection_getSale(?)', [sectorCollectionFk]);
|
||||
|
||||
const itemShelvings = [];
|
||||
for (let sale of sales) {
|
||||
const [carros] = await Self.rawSql(
|
||||
'CALL vn.itemPlacementSupplyStockGetTargetList(?, ?)',
|
||||
[sale.itemFk, sectorFk]
|
||||
);
|
||||
|
||||
itemShelvings.push({
|
||||
id: sale.ticketFk,
|
||||
itemFk: sale.itemFk,
|
||||
longName: sale.longName,
|
||||
packingType: sale.itemPackingTypeFk,
|
||||
subName: sale.subName,
|
||||
quantity: {saldo: sale.quantity},
|
||||
trabajador: sale.workerCode,
|
||||
idMovimiento: sale.saleFk,
|
||||
salesPersonFk: sale.salesPersonFk,
|
||||
picked: sale.pickedQuantity,
|
||||
carros
|
||||
});
|
||||
}
|
||||
|
||||
return itemShelvings;
|
||||
};
|
||||
};
|
|
@ -4,4 +4,5 @@ module.exports = Self => {
|
|||
require('../methods/item-shelving/makeMulti')(Self);
|
||||
require('../methods/item-shelving/return')(Self);
|
||||
require('../methods/item-shelving/updateFromSale')(Self);
|
||||
require('../methods/item-shelving/getSale')(Self);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue