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": { "Postcode": {
"dataSource": "vn" "dataSource": "vn"
}, },
"Prefix": {
"dataSource": "vn"
},
"ReferenceRate": { "ReferenceRate": {
"dataSource": "vn" "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, LEAST(bb.stickers, FLOOR(ish.visible / ish.packing)) ishStickers,
bb.stickers buyStickers bb.stickers buyStickers
FROM itemShelving ish FROM itemShelving ish
JOIN shelving sh ON sh.id = ish.shelvingFk
JOIN (SELECT b.id, b.itemFk, b.stickers JOIN (SELECT b.id, b.itemFk, b.stickers
FROM buy b FROM buy b
WHERE b.entryFk = vFromEntryFk WHERE b.entryFk = vFromEntryFk
ORDER BY b.stickers DESC ORDER BY b.stickers DESC
LIMIT 10000000000000000000) bb ON bb.itemFk = ish.itemFk 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 AND NOT ish.isSplit
GROUP BY ish.id; GROUP BY ish.id;

View File

@ -20,10 +20,6 @@ BEGIN
CALL travel_checkWarehouseIsFeedStock(NEW.warehouseInFk); CALL travel_checkWarehouseIsFeedStock(NEW.warehouseInFk);
END IF; 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 IF NOT (NEW.awbFk <=> OLD.awbFk)THEN
SELECT COUNT(*) INTO vHasAnyInvoiceBooked SELECT COUNT(*) INTO vHasAnyInvoiceBooked
FROM travel t 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', relation: 'country',
scope: { scope: {
fields: ['id', 'name'], fields: ['id', 'name', 'code'],
include: { include: {
relation: 'saySimpleCountry', relation: 'saySimpleCountry',
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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