This commit is contained in:
parent
bf2d7541a5
commit
0af58b20be
|
@ -0,0 +1,31 @@
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`buy_getUltimate`(
|
||||||
|
vItemFk INT,
|
||||||
|
vWarehouseFk SMALLINT,
|
||||||
|
vDated DATE
|
||||||
|
)
|
||||||
|
RETURNS int(11)
|
||||||
|
DETERMINISTIC
|
||||||
|
BEGIN
|
||||||
|
/**
|
||||||
|
* Calcula las últimas compras realizadas hasta una fecha.
|
||||||
|
*
|
||||||
|
* @param vItemFk Id del artículo
|
||||||
|
* @param vWarehouseFk Id del almacén
|
||||||
|
* @param vDated Compras hasta fecha
|
||||||
|
* @return Id de compra
|
||||||
|
*/
|
||||||
|
DECLARE vBuyFk INT;
|
||||||
|
|
||||||
|
CALL buy_getUltimate(vItemFk, vWarehouseFk, vDated);
|
||||||
|
|
||||||
|
SELECT buyFk INTO vBuyFk
|
||||||
|
FROM tmp.buyUltimate;
|
||||||
|
|
||||||
|
DROP TEMPORARY TABLE IF EXISTS
|
||||||
|
tmp.buyUltimate,
|
||||||
|
tmp.buyUltimateFromInterval;
|
||||||
|
|
||||||
|
RETURN vBuyFk;
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -383,5 +383,6 @@
|
||||||
"No valid travel thermograph found": "No se encontró un termógrafo válido",
|
"No valid travel thermograph found": "No se encontró un termógrafo válido",
|
||||||
"The quantity claimed cannot be greater than the quantity of the line": "La cantidad reclamada no puede ser mayor que la cantidad de la línea",
|
"The quantity claimed cannot be greater than the quantity of the line": "La cantidad reclamada no puede ser mayor que la cantidad de la línea",
|
||||||
"type cannot be blank": "Se debe rellenar el tipo",
|
"type cannot be blank": "Se debe rellenar el tipo",
|
||||||
"There are tickets for this area, delete them first": "Hay tickets para esta sección, borralos primero"
|
"There are tickets for this area, delete them first": "Hay tickets para esta sección, borralos primero",
|
||||||
|
"There is no company associated with that warehouse": "No hay ninguna empresa asociada a ese almacén"
|
||||||
}
|
}
|
|
@ -9,8 +9,15 @@ module.exports = Self => {
|
||||||
required: true,
|
required: true,
|
||||||
description: 'The item id',
|
description: 'The item id',
|
||||||
http: {source: 'path'}
|
http: {source: 'path'}
|
||||||
},
|
}, {
|
||||||
{
|
arg: 'warehouseId',
|
||||||
|
type: 'number',
|
||||||
|
required: true
|
||||||
|
}, {
|
||||||
|
arg: 'packing',
|
||||||
|
type: 'number',
|
||||||
|
required: false
|
||||||
|
}, {
|
||||||
arg: 'copies',
|
arg: 'copies',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
required: false
|
required: false
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
</td>
|
</td>
|
||||||
<td rowspan="2" class="xs-width center md-txt">
|
<td rowspan="2" class="xs-width center md-txt">
|
||||||
<div class="overflow-line cell">
|
<div class="overflow-line cell">
|
||||||
{{item.packing}}
|
{{packing || item.packing}}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td rowspan="2" class="xs-width center md-txt">
|
<td rowspan="2" class="xs-width center md-txt">
|
||||||
|
@ -89,7 +89,7 @@
|
||||||
</td>
|
</td>
|
||||||
<td rowspan="2" class="xs-width center cursive bold md-txt">
|
<td rowspan="2" class="xs-width center cursive bold md-txt">
|
||||||
<div class="overflow-line">
|
<div class="overflow-line">
|
||||||
{{`${item.labelNum} / ${totalPages}`}}
|
{{`${item.labelNum}/${item.quantity / (packing || item.packing)}`}}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -5,25 +5,33 @@ const qrcode = require('qrcode');
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'item-label-qr',
|
name: 'item-label-qr',
|
||||||
async serverPrefetch() {
|
async serverPrefetch() {
|
||||||
this.items = await this.rawSqlFromDef('item', [this.copies || 1, this.id]);
|
this.company = await this.findOneFromDef('company', [this.warehouseId]);
|
||||||
|
if (!this.company)
|
||||||
|
throw new UserError(`There is no company associated with that warehouse`);
|
||||||
|
|
||||||
|
this.date = Date.vnNew();
|
||||||
|
this.lastBuy = await this.findOneFromDef('lastBuy', [
|
||||||
|
this.id,
|
||||||
|
this.warehouseId,
|
||||||
|
this.date
|
||||||
|
]);
|
||||||
|
this.items = await this.rawSqlFromDef('item', [this.copies || 1, this.lastBuy.id]);
|
||||||
if (!this.items.length) throw new UserError(`Empty data source`);
|
if (!this.items.length) throw new UserError(`Empty data source`);
|
||||||
this.qr = await this.getQr(this.items[0].buyFk);
|
this.qr = await this.getQr(this.items[0].buyFk);
|
||||||
this.vnDate = Date.vnNew();
|
this.date = moment(this.date).format('WW/E');
|
||||||
this.date = moment(this.vnDate).format('YY/DD');
|
|
||||||
this.totalPages = this.items.length;
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getQr(data) {
|
getQr(data) {
|
||||||
data = {
|
data = {
|
||||||
company: 'vnl',
|
company: this.company,
|
||||||
user: this.userId,
|
user: this.userId,
|
||||||
created: this.vnDate,
|
created: this.date,
|
||||||
table: 'buy',
|
table: 'buy',
|
||||||
id: data
|
id: data
|
||||||
};
|
};
|
||||||
return qrcode.toDataURL(JSON.stringify(data), {
|
return qrcode.toDataURL(JSON.stringify(data), {
|
||||||
margin: 0,
|
margin: 0,
|
||||||
errorCorrectionLevel: 'H'
|
errorCorrectionLevel: 'L'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -33,6 +41,12 @@ module.exports = {
|
||||||
required: true,
|
required: true,
|
||||||
description: 'The item id'
|
description: 'The item id'
|
||||||
},
|
},
|
||||||
|
warehouseId: {
|
||||||
|
type: Number
|
||||||
|
},
|
||||||
|
packing: {
|
||||||
|
type: Number
|
||||||
|
},
|
||||||
copies: {
|
copies: {
|
||||||
type: Number
|
type: Number
|
||||||
},
|
},
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
SELECT co.code
|
||||||
|
FROM warehouse w
|
||||||
|
JOIN address a ON a.id = w.addressFk
|
||||||
|
JOIN client c ON c.id = a.clientFk
|
||||||
|
JOIN company co ON co.clientFk = c.id
|
||||||
|
WHERE w.id = ?
|
|
@ -0,0 +1 @@
|
||||||
|
SELECT buy_getUltimate(?, ?, ?) id
|
Loading…
Reference in New Issue