sacadores
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
c7a5d94ed0
commit
52f97e1dec
|
@ -4,9 +4,9 @@ module.exports = Self => {
|
||||||
accessType: 'WRITE',
|
accessType: 'WRITE',
|
||||||
accepts: [{
|
accepts: [{
|
||||||
arg: 'shelvingFk',
|
arg: 'shelvingFk',
|
||||||
type: 'Number',
|
type: 'String',
|
||||||
required: true,
|
required: true,
|
||||||
description: 'The sale id'
|
description: 'The shalving id'
|
||||||
}, {
|
}, {
|
||||||
arg: 'quantity',
|
arg: 'quantity',
|
||||||
type: 'Number',
|
type: 'Number',
|
||||||
|
@ -29,7 +29,7 @@ module.exports = Self => {
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.collectionFaults = async(ctx, shelvingFk, quantity, itemFk) => {
|
Self.collectionFaults = async(ctx, shelvingFk, quantity, itemFk) => {
|
||||||
query = `vn.collection_faults(?,?,?)`;
|
query = `CALL vn.collection_faults(?,?,?)`;
|
||||||
return await Self.rawSql(query, [shelvingFk, quantity, itemFk]);
|
return await Self.rawSql(query, [shelvingFk, quantity, itemFk]);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -12,6 +12,11 @@ module.exports = Self => {
|
||||||
type: 'Number',
|
type: 'Number',
|
||||||
required: true,
|
required: true,
|
||||||
description: 'The sector of worker'
|
description: 'The sector of worker'
|
||||||
|
}, {
|
||||||
|
arg: 'vWagons',
|
||||||
|
type: 'Number',
|
||||||
|
required: true,
|
||||||
|
description: 'The number of wagons'
|
||||||
}],
|
}],
|
||||||
returns: {
|
returns: {
|
||||||
type: 'Object',
|
type: 'Object',
|
||||||
|
@ -23,13 +28,13 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.collectionNew = async(ctx, collectionFk, sectorFk) => {
|
Self.collectionNew = async(ctx, collectionFk, sectorFk, vWagons) => {
|
||||||
let query = '';
|
let query = '';
|
||||||
|
|
||||||
if (!collectionFk) {
|
if (!collectionFk) {
|
||||||
const userId = ctx.req.accessToken.userId;
|
const userId = ctx.req.accessToken.userId;
|
||||||
query = `CALL vn.collection_newBeta(?,?)`;
|
query = `CALL vn.collectionTrain_newBeta(?,?,?)`;
|
||||||
const [result] = await Self.rawSql(query, [sectorFk, userId]);
|
const [result] = await Self.rawSql(query, [sectorFk, vWagons, userId]);
|
||||||
if (result.length == 0)
|
if (result.length == 0)
|
||||||
throw new Error(`No collections for today`);
|
throw new Error(`No collections for today`);
|
||||||
|
|
||||||
|
@ -48,7 +53,7 @@ module.exports = Self => {
|
||||||
query = `CALL vn.collectionSticker_print(?,?)`;
|
query = `CALL vn.collectionSticker_print(?,?)`;
|
||||||
// await Self.rawSql(query, [collectionFk, sectorFk]);
|
// await Self.rawSql(query, [collectionFk, sectorFk]);
|
||||||
|
|
||||||
return makeCollection(tickets, sales, placements);
|
return makeCollection(tickets, sales, placements, collectionFk);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -58,7 +63,7 @@ module.exports = Self => {
|
||||||
* @param {*} placements - Request placements
|
* @param {*} placements - Request placements
|
||||||
* @return {Object} Collection JSON
|
* @return {Object} Collection JSON
|
||||||
*/
|
*/
|
||||||
async function makeCollection(tickets, sales, placements) {
|
async function makeCollection(tickets, sales, placements, collectionFk) {
|
||||||
let collection = [];
|
let collection = [];
|
||||||
|
|
||||||
for (let i = 0; i < tickets.length; i++) {
|
for (let i = 0; i < tickets.length; i++) {
|
||||||
|
@ -74,7 +79,7 @@ module.exports = Self => {
|
||||||
for (let x = 0; x < sales.length; x++) {
|
for (let x = 0; x < sales.length; x++) {
|
||||||
if (sales[x]['ticketFk'] == ticket['ticketFk']) {
|
if (sales[x]['ticketFk'] == ticket['ticketFk']) {
|
||||||
let sale = {};
|
let sale = {};
|
||||||
|
sale['collectionFk'] = collectionFk;
|
||||||
sale['ticketFk'] = sales[x]['ticketFk'];
|
sale['ticketFk'] = sales[x]['ticketFk'];
|
||||||
sale['saleFk'] = sales[x]['saleFk'];
|
sale['saleFk'] = sales[x]['saleFk'];
|
||||||
sale['itemFk'] = sales[x]['itemFk'];
|
sale['itemFk'] = sales[x]['itemFk'];
|
||||||
|
|
|
@ -36,7 +36,7 @@ module.exports = Self => {
|
||||||
Self.collectionUpdateSale = async(ctx, sale, originalQuantity, ticketFk, stateFk) => {
|
Self.collectionUpdateSale = async(ctx, sale, originalQuantity, ticketFk, stateFk) => {
|
||||||
const userId = ctx.req.accessToken.userId;
|
const userId = ctx.req.accessToken.userId;
|
||||||
|
|
||||||
query = `vn.collection_updateSale(?,?,?,?,?)`;
|
query = `CALL vn.collection_updateSale(?,?,?,?,?)`;
|
||||||
return await Self.rawSql(query, [sale, originalQuantity, userId, stateFk, ticketFk]);
|
return await Self.rawSql(query, [sale, originalQuantity, userId, stateFk, ticketFk]);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue