7167-testToMaster_2414 #2244
|
@ -139,7 +139,7 @@
|
|||
"Claim state has changed to": "Se ha cambiado el estado de la reclamación [({{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}* a *{{newState}}*",
|
||||
"Client checked as validated despite of duplication": "Cliente comprobado a pesar de que existe el cliente id {{clientId}}",
|
||||
"ORDER_ROW_UNAVAILABLE": "No hay disponibilidad de este producto",
|
||||
"Distance must be lesser than 4000": "La distancia debe ser inferior a 4000",
|
||||
"Distance must be lesser than 1000": "La distancia debe ser inferior a 1000",
|
||||
"This ticket is deleted": "Este ticket está eliminado",
|
||||
"Unable to clone this travel": "No ha sido posible clonar este travel",
|
||||
"This thermograph id already exists": "La id del termógrafo ya existe",
|
||||
|
@ -336,6 +336,7 @@
|
|||
"Incorrect pin": "Pin incorrecto",
|
||||
"You already have the mailAlias": "Ya tienes este alias de correo",
|
||||
"The alias cant be modified": "Este alias de correo no puede ser modificado",
|
||||
"No tickets to invoice": "No hay tickets para facturar",
|
||||
"This ticket already has a cmr saved": "Este ticket ya tiene un cmr guardado",
|
||||
"Name should be uppercase": "El nombre debe ir en mayúscula",
|
||||
"Bank entity must be specified": "La entidad bancaria es obligatoria",
|
||||
|
@ -343,18 +344,5 @@
|
|||
"You cannot update these fields": "No puedes actualizar estos campos",
|
||||
"CountryFK cannot be empty": "El país no puede estar vacío",
|
||||
"Cmr file does not exist": "El archivo del cmr no existe",
|
||||
"You are not allowed to modify the alias": "No estás autorizado a modificar el alias",
|
||||
"No tickets to invoice": "No hay tickets para facturar",
|
||||
"This machine is already in use.": "Esta máquina ya está en uso.",
|
||||
"the plate does not exist": "La máquina {{plate}} no existe",
|
||||
"We do not have availability for the selected item": "No tenemos disponible el item seleccionado",
|
||||
"You are already using a machine": "Ya estás usando una máquina.",
|
||||
"this state does not exist": "Este estado no existe",
|
||||
"The line could not be marked": "No se ha podido marcar la línea",
|
||||
"The sale cannot be tracked": "La línea no puede ser rastreada",
|
||||
"Shelving not valid": "Carro no válido",
|
||||
"printerNotExists": "No existe la impresora",
|
||||
"There are not picking tickets": "No hay tickets para sacar",
|
||||
"ticketCommercial": "El ticket {{ticket}} del comercial {{salesMan}} está en preparación.(mensaje creado automáticamente)",
|
||||
|
||||
"We do not have availability for the selected item": "No tenemos disponible el artículo seleccionado"
|
||||
}
|
|
@ -1,3 +1,4 @@
|
|||
const UserError = require('vn-loopback/util/user-error');
|
||||
module.exports = Self => {
|
||||
Self.remoteMethodCtx('addSaleByCode', {
|
||||
description: 'Add a collection',
|
||||
|
@ -15,6 +16,10 @@ module.exports = Self => {
|
|||
arg: 'ticketFk',
|
||||
type: 'number',
|
||||
required: true
|
||||
}, {
|
||||
arg: 'warehouseFk',
|
||||
type: 'number',
|
||||
required: true
|
||||
},
|
||||
|
||||
],
|
||||
|
@ -24,8 +29,7 @@ module.exports = Self => {
|
|||
},
|
||||
});
|
||||
|
||||
Self.addSaleByCode = async(ctx, code, quantity, ticketFk, options) => {
|
||||
const models = Self.app.models;
|
||||
Self.addSaleByCode = async(ctx, code, quantity, ticketFk, warehouseFk, options) => {
|
||||
const myOptions = {};
|
||||
let tx;
|
||||
|
||||
|
@ -38,8 +42,10 @@ module.exports = Self => {
|
|||
}
|
||||
|
||||
try {
|
||||
const [{itemFk}] = await Self.rawSql('SELECT barcodeToItem(?) itemFk', [code], myOptions);
|
||||
await models.Ticket.addSale(ctx, ticketFk, itemFk, quantity, myOptions);
|
||||
const [[item]] = await Self.rawSql('CALL vn.item_getInfo(?,?)', [code, warehouseFk], myOptions);
|
||||
if (!item?.available) throw new UserError('We do not have availability for the selected item');
|
||||
|
||||
await Self.rawSql('CALL vn.collection_addItem(?, ?, ?)', [item.id, quantity, ticketFk], myOptions);
|
||||
|
||||
if (tx) await tx.commit();
|
||||
} catch (e) {
|
||||
|
|
Loading…
Reference in New Issue