Compare commits
2 Commits
dev
...
5867-drive
Author | SHA1 | Date |
---|---|---|
Sergio De la torre | b07072ee56 | |
Sergio De la torre | ca4086d115 |
|
@ -0,0 +1,20 @@
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelvingSale_reserveBySale`(
|
||||||
|
vSaleFk INT ,
|
||||||
|
vUserFk INT
|
||||||
|
)
|
||||||
|
BEGIN
|
||||||
|
/**
|
||||||
|
* Reserva cantida y ubicación para una saleFk
|
||||||
|
*
|
||||||
|
* @param vSaleFk Identificador de la venta
|
||||||
|
* @param vQuantity Cantidad a reservar
|
||||||
|
* @param vUserFk Id de usuario que realiza la reserva
|
||||||
|
*/
|
||||||
|
CREATE OR REPLACE TEMPORARY TABLE tmp.sale
|
||||||
|
ENGINE = MEMORY
|
||||||
|
SELECT vSaleFk saleFk, vUserFk userFk;
|
||||||
|
|
||||||
|
CALL itemShelvingSale_reserve();
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -0,0 +1,28 @@
|
||||||
|
module.exports = Self => {
|
||||||
|
Self.remoteMethodCtx('itemShelvingSaleBySale', {
|
||||||
|
description: 'Insert sale in itemShelvingSale',
|
||||||
|
accessType: 'WRITE',
|
||||||
|
accepts: [
|
||||||
|
{
|
||||||
|
arg: 'id',
|
||||||
|
type: 'number',
|
||||||
|
description: 'The sale id',
|
||||||
|
required: true,
|
||||||
|
http: { source: 'path' }
|
||||||
|
}
|
||||||
|
],
|
||||||
|
http: {
|
||||||
|
path: `/:id/itemShelvingSaleBySale`,
|
||||||
|
verb: 'POST'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Self.itemShelvingSaleBySale = async (ctx, id, options) => {
|
||||||
|
const myOptions = { userId: ctx.req.accessToken.userId };
|
||||||
|
|
||||||
|
if (typeof options == 'object')
|
||||||
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
|
await Self.rawSql(`CALL vn.itemShelvingSale_reserveBySale(?)`, [id], myOptions);
|
||||||
|
};
|
||||||
|
};
|
|
@ -1,5 +1,6 @@
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
require('../methods/item-shelving-sale/filter')(Self);
|
require('../methods/item-shelving-sale/filter')(Self);
|
||||||
require('../methods/item-shelving-sale/itemShelvingSaleByCollection')(Self);
|
require('../methods/item-shelving-sale/itemShelvingSaleByCollection')(Self);
|
||||||
|
require('../methods/item-shelving-sale/itemShelvingSaleBySale')(Self);
|
||||||
require('../methods/item-shelving-sale/itemShelvingSaleSetQuantity')(Self);
|
require('../methods/item-shelving-sale/itemShelvingSaleSetQuantity')(Self);
|
||||||
};
|
};
|
||||||
|
|
|
@ -17,6 +17,9 @@
|
||||||
},
|
},
|
||||||
"created": {
|
"created": {
|
||||||
"type": "date"
|
"type": "date"
|
||||||
|
},
|
||||||
|
"isPicked": {
|
||||||
|
"type": "Boolean"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"relations": {
|
"relations": {
|
||||||
|
|
|
@ -20,7 +20,7 @@ SELECT
|
||||||
u.nickName salesPersonName,
|
u.nickName salesPersonName,
|
||||||
ipkg.itemPackingTypes
|
ipkg.itemPackingTypes
|
||||||
FROM route r
|
FROM route r
|
||||||
LEFT JOIN ticket t ON t.routeFk = r.id
|
JOIN ticket t ON t.routeFk = r.id
|
||||||
LEFT JOIN address a ON a.id = t.addressFk
|
LEFT JOIN address a ON a.id = t.addressFk
|
||||||
LEFT JOIN client c ON c.id = t.clientFk
|
LEFT JOIN client c ON c.id = t.clientFk
|
||||||
LEFT JOIN worker w ON w.id = client_getSalesPerson(t.clientFk, CURDATE())
|
LEFT JOIN worker w ON w.id = client_getSalesPerson(t.clientFk, CURDATE())
|
||||||
|
|
Loading…
Reference in New Issue