#6276 createNewWarehouse methods migrated from silex to salix #1850

Merged
jorgep merged 158 commits from 6276-createNewWarehouse into dev 2024-03-06 11:32:11 +00:00
1 changed files with 26 additions and 3 deletions
Showing only changes of commit fafc25ed19 - Show all commits

View File

@ -1,5 +1,5 @@
module.exports = Self => {
Self.remoteMethod('getFromSectorCollection', {
Self.remoteMethodCtx('getFromSectorCollection', {
jgallego marked this conversation as resolved
Review

confirma con @sergiodt que esto pasa así a salix, o se separa..o hay alguna tarea para separarlo

confirma con @sergiodt que esto pasa así a salix, o se separa..o hay alguna tarea para separarlo
Review

@jgallego Separarlo en quin sentit ? És el back que trau les linies de previa amb les seues ubicacions.....

@jgallego Separarlo en quin sentit ? És el back que trau les linies de previa amb les seues ubicacions.....
Review

Crec que m'he confós tenia en ment allò de ticket or collection, tot clar.

Crec que m'he confós tenia en ment allò de ticket or collection, tot clar.
description: 'Get sales from sector collection',
accessType: 'READ',
accepts: [
@ -24,12 +24,35 @@ module.exports = Self => {
},
});
Self.getFromSectorCollection = async(sectorCollectionFk, sectorFk, options) => {
Self.getFromSectorCollection = async(ctx, sectorCollectionFk, sectorFk, options) => {
const myOptions = {};
const userId = ctx.req.accessToken.userId;
if (typeof options == 'object') Object.assign(myOptions, options);
const [sales] = await Self.rawSql('CALL vn.sectorCollection_getSale(?)', [sectorCollectionFk]);
const sales = await Self.rawSql(
`SELECT s.ticketFk,
s.itemFk,
i.longName,
itemPackingTypeFk,
subName,
s.quantity,
w.code workerCode,
sgd.saleFk,
iss.quantity pickedQuantity,
c.salesPersonFk
FROM vn.sale s
JOIN item i ON i.id = s.itemFk
JOIN saleGroupDetail sgd ON sgd.saleFk = s.id
JOIN sectorCollectionSaleGroup scsg ON scsg.saleGroupFk = sgd.saleGroupFk
JOIN saleTracking st ON st.saleFk = s.id
JOIN state stt ON stt.id = st.stateFk AND stt.code = 'PREVIOUS_PREPARATION'
JOIN worker w ON w.id = st.workerFk
JOIN ticket t ON t.id= s.ticketFk
JOIN client c ON c.id=t.clientFk
LEFT JOIN itemShelvingSaleSum iss ON iss.saleFk = s.id
WHERE scsg.sectorCollectionFk = ?
AND st.workerFk = ?;`, [sectorCollectionFk, userId]);
const itemShelvings = [];
for (let sale of sales) {