8355-testToMaster #3336

Merged
alexm merged 241 commits from 8355-testToMaster into master 2025-01-07 06:44:57 +00:00
14 changed files with 75 additions and 28 deletions
Showing only changes of commit 7afd14a301 - Show all commits

View File

@ -133,6 +133,9 @@
"Postcode": {
"dataSource": "vn"
},
"Prefix": {
"dataSource": "vn"
},
"ReferenceRate": {
"dataSource": "vn"
},

27
back/models/prefix.json Normal file
View File

@ -0,0 +1,27 @@
{
"name": "Prefix",
"base": "VnModel",
"options": {
"mysql": {
"table": "pbx.prefix"
}
},
"properties": {
"country": {
"type": "string",
"id": true
},
"prefix": {
"type": "string"
}
},
"acls": [
{
"property": "*",
"accessType": "READ",
"principalType": "ROLE",
"principalId": "employee",
"permission": "ALLOW"
}
]
}

View File

@ -23,12 +23,13 @@ BEGIN
LEAST(bb.stickers, FLOOR(ish.visible / ish.packing)) ishStickers,
bb.stickers buyStickers
FROM itemShelving ish
JOIN shelving sh ON sh.id = ish.shelvingFk
JOIN (SELECT b.id, b.itemFk, b.stickers
FROM buy b
WHERE b.entryFk = vFromEntryFk
ORDER BY b.stickers DESC
LIMIT 10000000000000000000) bb ON bb.itemFk = ish.itemFk
WHERE ish.shelvingFk = vShelvingCode COLLATE utf8_general_ci
WHERE sh.code = vShelvingCode COLLATE utf8_general_ci
AND NOT ish.isSplit
GROUP BY ish.id;

View File

@ -20,10 +20,6 @@ BEGIN
CALL travel_checkWarehouseIsFeedStock(NEW.warehouseInFk);
END IF;
IF NOT (NEW.isRaid <=> OLD.isRaid) OR NOT (NEW.daysInForward <=> OLD.daysInForward) THEN
CALL travel_checkRaid(NEW.isRaid, NEW.daysInForward);
END IF;
IF NOT (NEW.awbFk <=> OLD.awbFk)THEN
SELECT COUNT(*) INTO vHasAnyInvoiceBooked
FROM travel t

View File

@ -0,0 +1,5 @@
ALTER TABLE vn.duaInvoiceIn DROP KEY IF EXISTS duaFk_UNIQUE;
ALTER TABLE vn.duaInvoiceIn DROP KEY IF EXISTS duaInvoiceIn_unique;
ALTER TABLE vn.duaInvoiceIn ADD CONSTRAINT duaInvoiceIn_unique
UNIQUE KEY (invoiceInFk);

View File

@ -54,7 +54,7 @@ module.exports = Self => {
{
relation: 'country',
scope: {
fields: ['id', 'name'],
fields: ['id', 'name', 'code'],
include: {
relation: 'saySimpleCountry',
}

View File

@ -1,6 +1,6 @@
const UserError = require('vn-loopback/util/user-error');
module.exports = Self => {
Self.remoteMethodCtx('print', {
Self.remoteMethodCtx('labelSupplier', {
description: 'Print stickers of all entries',
accessType: 'READ',
accepts: [
@ -28,13 +28,13 @@ module.exports = Self => {
}
],
http: {
path: '/:id/print',
path: '/:id/labelSupplier',
verb: 'GET'
},
accessScopes: ['DEFAULT', 'read:multimedia']
});
Self.print = async function(ctx, id, options) {
Self.labelSupplier = async function(ctx, id, options) {
const models = Self.app.models;
const myOptions = {};
if (typeof options == 'object')
@ -48,7 +48,8 @@ module.exports = Self => {
for (const buy of buys) {
if (buy.stickers < 1) continue;
ctx.args.id = buy.id;
const pdfBuffer = await models.Entry.buyLabel(ctx, myOptions);
ctx.args.copies = buy.stickers;
const pdfBuffer = await models.Entry.buyLabelSupplier(ctx, myOptions);
await merger.add(new Uint8Array(pdfBuffer[0]));
}

View File

@ -12,7 +12,8 @@ module.exports = Self => {
require('../methods/entry/addFromPackaging')(Self);
require('../methods/entry/addFromBuy')(Self);
require('../methods/entry/buyLabel')(Self);
require('../methods/entry/print')(Self);
require('../methods/entry/labelSupplier')(Self);
require('../methods/entry/buyLabelSupplier')(Self);
Self.observe('before save', async function(ctx, options) {
if (ctx.isNewInstance) return;

View File

@ -32,6 +32,11 @@ td {
.md-txt {
font-size: 26px;
}
.lg-txt {
font-size: 40px;
padding: 0px;
line-height: 1;
}
.xl-txt {
font-size: 50px;
}

View File

@ -36,12 +36,12 @@
</td>
</tr>
<tr>
<td class="md-txt xl-width bold center">
<td class="bold center lg-txt xl-width">
<div class="overflow-line">
{{buy.itemFk}}
{{formatNumber(buy.itemFk)}}
</div>
</td>
<td colspan="2" class="md-txt md-width center">
<td colspan="2" class="center md-txt md-width">
<div class="overflow-line">
{{`${(packing || buy.packing)} x ${buy.stems || ''}`}}
</div>
@ -56,7 +56,7 @@
{{'LAID'}}
</div>
<div v-else class="overflow-line">
{{buy.entryFk}}
{{formatNumber(buy.entryFk)}}
</div>
</td>
</tr>
@ -73,17 +73,17 @@
</td>
</tr>
<tr>
<td class="center xl-width">
<td class="center xs-txt xl-width">
<div class="overflow-line">
{{buy.buyFk}}
{{formatNumber(buy.buyFk)}}
</div>
</td>
<td class="xs-txt sm-width center">
<td class="center xs-txt sm-width">
<div class="overflow-line">
{{date}}
</div>
</td>
<td class="xs-txt sm-width cursive center bold">
<td class="cursive center bold xs-txt sm-width">
<div class="overflow-line">
{{`${buy.labelNum}/${buy.quantity / (packing || buy.packing)}`}}
</div>

View File

@ -9,7 +9,7 @@ module.exports = {
this.date = Date.vnNew();
this.buys = await this.rawSqlFromDef('buy', [this.copies || 1, this.id]);
if (!this.buys.length) throw new UserError(`Empty data source`);
this.date = moment(this.date).format('WW/E');
this.date = moment(this.date).format('WW/DD');
},
methods: {
getBarcode(data) {
@ -21,10 +21,13 @@ module.exports = {
format: 'code128',
displayValue: false,
width: 3.8,
height: 85,
height: 75,
margin: 0
});
return new XMLSerializer().serializeToString(svgNode);
},
formatNumber(number) {
return new Intl.NumberFormat('es-ES', {maximumFractionDigits: 0}).format(number);
}
},
props: {

View File

@ -34,6 +34,9 @@ html {
background-color: black;
color: white;
}
.sm-txt {
font-size: 18px;
}
.md-txt {
font-size: 20px;
}

View File

@ -11,8 +11,8 @@
</td>
</tr>
<tr>
<td colspan="2">
{{buy.buyFk}}
<td colspan="2" class="sm-txt">
{{formatNumber(buy.buyFk)}}
</td>
</tr>
<tr>
@ -28,7 +28,7 @@
<tr>
<td colspan="3" class="lg-width black-bg center bold xl-txt padding">
<div class="overflow-line">
{{buy.itemFk}}
{{formatNumber(buy.itemFk)}}
</div>
</td>
</tr>
@ -78,8 +78,7 @@
<div v-if="buy.isLaid && typeId === 'buy'" class="overflow-line black-bg bold">
{{'LAID'}}
</div>
<div v-else class="overflow-line">
{{buy.entryFk}}
<div v-else class="overflow-line xs-txt">
</div>
</td>
</tr>
@ -103,7 +102,7 @@
<tr>
<td class="sm-width">
<div class="overflow-line">
<i>Entrada:</i> {{buy.entryFk}}
<i>Entrada:</i> {{formatNumber(buy.entryFk)}}
</div>
</td>
</tr>

View File

@ -9,7 +9,7 @@ module.exports = {
this.buys = await this.rawSqlFromDef('buy', [this.copies || 1, this.id]);
if (!this.buys.length) throw new UserError(`Empty data source`);
this.qr = await this.getQr(this.buys[0].buyFk);
this.date = moment(this.date).format('WW/E');
this.date = moment(this.date).format('WW/DD');
},
methods: {
getQr(data) {
@ -24,6 +24,9 @@ module.exports = {
margin: 0,
errorCorrectionLevel: 'L'
});
},
formatNumber(number) {
return new Intl.NumberFormat('es-ES', {maximumFractionDigits: 0}).format(number);
}
},
props: {