8144-devToTest_2448 #3216

Merged
alexm merged 256 commits from 8144-devToTest_2448 into test 2024-11-19 07:36:04 +00:00
7 changed files with 72 additions and 12 deletions
Showing only changes of commit 0af58b20be - Show all commits

View File

@ -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 ;

View File

@ -383,5 +383,6 @@
"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",
"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"
}

View File

@ -9,8 +9,15 @@ module.exports = Self => {
required: true,
description: 'The item id',
http: {source: 'path'}
},
{
}, {
arg: 'warehouseId',
type: 'number',
required: true
}, {
arg: 'packing',
type: 'number',
required: false
}, {
arg: 'copies',
type: 'number',
required: false

View File

@ -52,7 +52,7 @@
</td>
<td rowspan="2" class="xs-width center md-txt">
<div class="overflow-line cell">
{{item.packing}}
{{packing || item.packing}}
</div>
</td>
<td rowspan="2" class="xs-width center md-txt">
@ -89,7 +89,7 @@
</td>
<td rowspan="2" class="xs-width center cursive bold md-txt">
<div class="overflow-line">
{{`${item.labelNum} / ${totalPages}`}}
{{`${item.labelNum}/${item.quantity / (packing || item.packing)}`}}
</div>
</td>
</tr>

View File

@ -5,25 +5,33 @@ const qrcode = require('qrcode');
module.exports = {
name: 'item-label-qr',
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`);
this.qr = await this.getQr(this.items[0].buyFk);
this.vnDate = Date.vnNew();
this.date = moment(this.vnDate).format('YY/DD');
this.totalPages = this.items.length;
this.date = moment(this.date).format('WW/E');
},
methods: {
getQr(data) {
data = {
company: 'vnl',
company: this.company,
user: this.userId,
created: this.vnDate,
created: this.date,
table: 'buy',
id: data
};
return qrcode.toDataURL(JSON.stringify(data), {
margin: 0,
errorCorrectionLevel: 'H'
errorCorrectionLevel: 'L'
});
}
},
@ -33,6 +41,12 @@ module.exports = {
required: true,
description: 'The item id'
},
warehouseId: {
type: Number
},
packing: {
type: Number
},
copies: {
type: Number
},

View File

@ -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 = ?

View File

@ -0,0 +1 @@
SELECT buy_getUltimate(?, ?, ?) id