#6276 createNewWarehouse methods migrated from silex to salix #1850
|
@ -16,7 +16,6 @@ module.exports = Self => {
|
||||||
Self.assignCollection = async(ctx, options) => {
|
Self.assignCollection = async(ctx, options) => {
|
||||||
const userId = ctx.req.accessToken.userId;
|
const userId = ctx.req.accessToken.userId;
|
||||||
const myOptions = {userId};
|
const myOptions = {userId};
|
||||||
const $t = ctx.req.__;
|
|
||||||
|
|
||||||
if (typeof options == 'object')
|
if (typeof options == 'object')
|
||||||
Object.assign(myOptions, options);
|
Object.assign(myOptions, options);
|
||||||
|
@ -26,7 +25,7 @@ module.exports = Self => {
|
||||||
const [assignedCollection] = await Self.rawSql('SELECT @vCollectionFk');
|
const [assignedCollection] = await Self.rawSql('SELECT @vCollectionFk');
|
||||||
const {'@vCollectionFk': collectionFk} = assignedCollection;
|
const {'@vCollectionFk': collectionFk} = assignedCollection;
|
||||||
|
|
||||||
if (!collectionFk) throw new UserError($t('There are not picking tickets'));
|
if (!collectionFk) throw new UserError('There are not picking tickets');
|
||||||
await Self.rawSql('CALL vn.collection_printSticker(?, NULL)', [collectionFk], myOptions);
|
await Self.rawSql('CALL vn.collection_printSticker(?, NULL)', [collectionFk], myOptions);
|
||||||
jorgep marked this conversation as resolved
Outdated
|
|||||||
|
|
||||||
return collectionFk;
|
return collectionFk;
|
||||||
|
|
|
@ -29,9 +29,9 @@ module.exports = Self => {
|
||||||
let fields = ['id', 'appName'];
|
let fields = ['id', 'appName'];
|
||||||
|
|
||||||
if (workerFk)
|
if (workerFk)
|
||||||
jorgep marked this conversation as resolved
alexm
commented
Javascript tiene una forma muy sencilla de 'fusionar' arrays Javascript tiene una forma muy sencilla de 'fusionar' arrays
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat
|
|||||||
fields = [...fields, ...['isVersionBetaCritical', 'versionBeta', 'urlBeta']];
|
fields = fields.concat(['isVersionBetaCritical', 'versionBeta', 'urlBeta']);
|
||||||
else
|
else
|
||||||
fields = [...fields, ...['isVersionCritical', 'version', 'urlProduction']];
|
fields = fields.concat(['isVersionCritical', 'version', 'urlProduction']);
|
||||||
|
|
||||||
const filter = {
|
const filter = {
|
||||||
where: {
|
where: {
|
||||||
|
@ -40,6 +40,6 @@ module.exports = Self => {
|
||||||
fields,
|
fields,
|
||||||
};
|
};
|
||||||
|
|
||||||
return await Self.findOne(filter);
|
return Self.findOne(filter);
|
||||||
jorgep marked this conversation as resolved
Outdated
alexm
commented
en un return no hace falta poner 'await' Bing:
en un return no hace falta poner 'await'
Bing:
```
En JavaScript, la mayoría de las veces, no hay diferencia observable entre return await myFunction() y return myFunction()12. Ambas versiones tienen el mismo comportamiento observable.
```
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -212,7 +212,7 @@
|
||||||
"This worker does not exist": "This worker does not exist",
|
"This worker does not exist": "This worker does not exist",
|
||||||
"this state does not exist": "This state does not exist",
|
"this state does not exist": "This state does not exist",
|
||||||
"The line could not be marked": "The line could not be marked",
|
"The line could not be marked": "The line could not be marked",
|
||||||
"The sale can not be tracked": "The sale can not be tracked",
|
"The sale cannot be tracked": "The sale cannot be tracked",
|
||||||
"Shelving not valid": "Shelving not valid",
|
"Shelving not valid": "Shelving not valid",
|
||||||
"printerNotExists": "The printer does not exist",
|
"printerNotExists": "The printer does not exist",
|
||||||
"There are not picking tickets": "There are not picking tickets",
|
"There are not picking tickets": "There are not picking tickets",
|
||||||
|
|
|
@ -347,7 +347,7 @@
|
||||||
"This worker does not exist": "Este trabajador no existe",
|
"This worker does not exist": "Este trabajador no existe",
|
||||||
"this state does not exist": "Este estado no existe",
|
"this state does not exist": "Este estado no existe",
|
||||||
"The line could not be marked": "No se ha podido marcar la línea",
|
"The line could not be marked": "No se ha podido marcar la línea",
|
||||||
"The sale can not be tracked": "La línea no puede ser rastreada",
|
"The sale cannot be tracked": "La línea no puede ser rastreada",
|
||||||
"Shelving not valid": "Carro no válido",
|
"Shelving not valid": "Carro no válido",
|
||||||
"printerNotExists": "No existe la impresora",
|
"printerNotExists": "No existe la impresora",
|
||||||
"There are not picking tickets": "No hay tickets para sacar",
|
"There are not picking tickets": "No hay tickets para sacar",
|
||||||
|
|
|
@ -36,7 +36,6 @@ module.exports = Self => {
|
||||||
fields: ['code'],
|
fields: ['code'],
|
||||||
where: {
|
where: {
|
||||||
jorgep marked this conversation as resolved
Outdated
jgallego
commented
quitar esta llamada, dentro de item_getInfo ya se llama a barcodeToItem por tanto itemInfo ya contiene el id que se busca quitar esta llamada, dentro de item_getInfo ya se llama a barcodeToItem por tanto itemInfo ya contiene el id que se busca
jorgep
commented
@sergiodt es correcto o quieres los barcodes tambien? @sergiodt es correcto o quieres los barcodes tambien?
|
|||||||
itemFk: realIdItem
|
itemFk: realIdItem
|
||||||
|
|
||||||
}
|
}
|
||||||
jorgep marked this conversation as resolved
Outdated
jgallego
commented
quitar salto quitar salto
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -90,12 +90,12 @@ module.exports = Self => {
|
||||||
const buy = await models.Buy.findById(buyFk, myOptions);
|
const buy = await models.Buy.findById(buyFk, myOptions);
|
||||||
if (buy.itemOriginalFk) await models.SaleBuy.create({saleFk, buyFk}, myOptions);
|
if (buy.itemOriginalFk) await models.SaleBuy.create({saleFk, buyFk}, myOptions);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw new UserError($t('The sale can not be tracked'));
|
throw new UserError($t('The sale cannot be tracked'));
|
||||||
jorgep marked this conversation as resolved
Outdated
alexm
commented
No hace falta usar $t, UserError traduce por defecto. No hace falta usar $t, UserError traduce por defecto.
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (tx) await tx.commit();
|
if (tx) await tx.commit();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e.message == $t('The sale can not be tracked')) {
|
if (e.message == $t('The sale cannot be tracked')) {
|
||||||
jorgep marked this conversation as resolved
Outdated
jgallego
commented
cannot cannot
|
|||||||
if (tx) tx.commit();
|
if (tx) tx.commit();
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,7 @@ describe('saleTracking mark()', () => {
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
const error = e;
|
const error = e;
|
||||||
|
|
||||||
expect(error.message).toEqual('The sale can not be tracked');
|
expect(error.message).toEqual('The sale cannot be tracked');
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -50,14 +50,17 @@ describe('ticket setDeleted()', () => {
|
||||||
return value;
|
return value;
|
||||||
};
|
};
|
||||||
const ticketId = 23;
|
const ticketId = 23;
|
||||||
|
const [sectorCollectionBefore] = await models.Ticket.rawSql(
|
||||||
await models.Ticket.setDeleted(ctx, ticketId, options);
|
|
||||||
|
|
||||||
const [sectorCollection] = await models.Ticket.rawSql(
|
|
||||||
`SELECT COUNT(*) numberRows
|
`SELECT COUNT(*) numberRows
|
||||||
FROM vn.sectorCollection`, [], options);
|
FROM vn.sectorCollection`, [], options);
|
||||||
|
|
||||||
expect(sectorCollection.numberRows).toEqual(1);
|
await models.Ticket.setDeleted(ctx, ticketId, options);
|
||||||
|
|
||||||
|
const [sectorCollectionAfter] = await models.Ticket.rawSql(
|
||||||
|
`SELECT COUNT(*) numberRows
|
||||||
jorgep marked this conversation as resolved
Outdated
jgallego
commented
ejecuta antes de borrar SELECT COUNT(*) numberRows ejecuta antes de borrar SELECT COUNT(*) numberRows
FROM vn.sectorCollection`, [], options);
FROM vn.sectorCollection
y así quitas el uno y el test lo haces dinamico
|
|||||||
|
FROM vn.sectorCollection`, [], options);
|
||||||
|
|
||||||
|
expect(sectorCollectionAfter.numberRows).toEqual(sectorCollectionBefore.numberRows - 1);
|
||||||
|
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
@ -12,9 +12,6 @@
|
||||||
"id": true,
|
"id": true,
|
||||||
"description": "Identifier"
|
"description": "Identifier"
|
||||||
},
|
},
|
||||||
"truckFk": {
|
|
||||||
"type": "number"
|
|
||||||
},
|
|
||||||
"built": {
|
"built": {
|
||||||
jorgep marked this conversation as resolved
jgallego
commented
al poner la relacion este bloque lo puedes quitar al poner la relacion este bloque lo puedes quitar
|
|||||||
"type": "date"
|
"type": "date"
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue
No hace falta usar $t, UserError traduce por defecto.