7152-devToTest_2414 #2228
|
@ -3707,9 +3707,8 @@ INSERT INTO `vn`.`machine` (`plate`, `maker`, `model`, `warehouseFk`, `departmen
|
|||
('RE-003', 'IRON', 'JPH-24', 60, 23, 'ELECTRIC TOW', 'Drag cars', 2020, 103, 442);
|
||||
|
||||
|
||||
INSERT INTO vn.machineWorker(workerFk,machineFk,inTimed)
|
||||
VALUES (104,1,'2001-01-01 10:00:00.00.000');
|
||||
INSERT INTO vn.machineWorker(workerFk,machineFk,inTimed) VALUES (104,1,'2001-01-01 10:00:00.00.000');
|
||||
|
||||
UPDATE vn.buy
|
||||
SET itemOriginalFk = 1
|
||||
WHERE id = 1;
|
||||
UPDATE vn.buy SET itemOriginalFk = 1 WHERE id = 1;
|
||||
|
||||
UPDATE vn.saleTracking SET stateFk = 26 WHERE id = 5;
|
|
@ -349,5 +349,6 @@
|
|||
"Este estado no existe": "Este estado no existe",
|
||||
"The line could not be marked": "No se ha podido marcar la línea",
|
||||
"No se ha podido marcar la línea": "No se ha podido marcar la línea",
|
||||
"The sale can not be tracked": "La línea no puede ser rastreada"
|
||||
"The sale can not be tracked": "La línea no puede ser rastreada",
|
||||
"La línea no puede ser rastreada": "La línea no puede ser rastreada"
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
const {models} = require('vn-loopback/server/server');
|
||||
fdescribe('saleTracking mark()', () => {
|
||||
describe('saleTracking mark()', () => {
|
||||
const saleFk = 1;
|
||||
const originalQuantity = 10;
|
||||
const code = 'PREPARED';
|
||||
|
|
|
@ -25,36 +25,12 @@ module.exports = Self => {
|
|||
});
|
||||
|
||||
Self.getFromSectorCollection = async(ctx, sectorCollectionFk, sectorFk, options) => {
|
||||
const myOptions = {};
|
||||
const userId = ctx.req.accessToken.userId;
|
||||
const myOptions = {userId};
|
||||
|
||||
if (typeof options == 'object') Object.assign(myOptions, options);
|
||||
|
||||
const sales = await Self.rawSql('CALL sectorCollection_getSale(?)', [sectorCollectionFk], myOptions);
|
||||
|
||||
/* 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 [sales] = await Self.rawSql('CALL sectorCollection_getSale(?)', [sectorCollectionFk], myOptions);
|
||||
|
||||
const itemShelvings = [];
|
||||
for (let sale of sales) {
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
const {models} = require('vn-loopback/server/server');
|
||||
|
||||
describe('sale getFromSectorCollection()', () => {
|
||||
const sectorCollectionFk = 1;
|
||||
const sectorFk = 1;
|
||||
|
||||
beforeAll(async() => {
|
||||
ctx = {
|
||||
req: {
|
||||
headers: {origin: 'http://localhost'},
|
||||
accessToken: {userId: 40}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
it('should find an item and a shelving', async() => {
|
||||
const options = {};
|
||||
const itemShelvings = await models.Sale.getFromSectorCollection(ctx, sectorCollectionFk, sectorFk, options);
|
||||
|
||||
expect(itemShelvings.length).toEqual(1);
|
||||
expect(itemShelvings[0].carros.length).toEqual(1);
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue