8144-devToTest_2448 #3216
|
@ -1723,7 +1723,6 @@ INSERT INTO `ACL` VALUES (378,'OsTicket','osTicketReportEmail','WRITE','ALLOW','
|
|||
INSERT INTO `ACL` VALUES (379,'Item','buyerWasteEmail','WRITE','ALLOW','ROLE','system',NULL);
|
||||
INSERT INTO `ACL` VALUES (380,'Claim','claimPickupPdf','READ','ALLOW','ROLE','employee',NULL);
|
||||
INSERT INTO `ACL` VALUES (381,'Claim','claimPickupEmail','WRITE','ALLOW','ROLE','claimManager',NULL);
|
||||
INSERT INTO `ACL` VALUES (382,'Item','itemLabelQr','READ','ALLOW','ROLE','employee',NULL);
|
||||
INSERT INTO `ACL` VALUES (383,'Sector','*','READ','ALLOW','ROLE','employee',NULL);
|
||||
INSERT INTO `ACL` VALUES (384,'Sector','*','WRITE','ALLOW','ROLE','employee',NULL);
|
||||
INSERT INTO `ACL` VALUES (385,'Route','driverRoutePdf','READ','ALLOW','ROLE','employee',NULL);
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
DELETE FROM salix.ACL
|
||||
WHERE property = 'labelPdf'
|
||||
AND model = 'Item';
|
|
@ -0,0 +1,55 @@
|
|||
module.exports = Self => {
|
||||
Self.remoteMethodCtx('labelBarcodePdf', {
|
||||
description: 'Returns the item label pdf with barcode',
|
||||
accessType: 'READ',
|
||||
accepts: [
|
||||
{
|
||||
arg: 'id',
|
||||
type: 'number',
|
||||
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
|
||||
}, {
|
||||
arg: 'userId',
|
||||
type: 'number',
|
||||
description: 'The user id from accessToken',
|
||||
http: ctx => ctx.req.accessToken.userId,
|
||||
required: true
|
||||
}
|
||||
],
|
||||
returns: [
|
||||
{
|
||||
arg: 'body',
|
||||
type: 'file',
|
||||
root: true
|
||||
}, {
|
||||
arg: 'Content-Type',
|
||||
type: 'String',
|
||||
http: {target: 'header'}
|
||||
}, {
|
||||
arg: 'Content-Disposition',
|
||||
type: 'String',
|
||||
http: {target: 'header'}
|
||||
}
|
||||
],
|
||||
http: {
|
||||
path: '/:id/label-barcode-pdf',
|
||||
verb: 'GET'
|
||||
},
|
||||
accessScopes: ['DEFAULT', 'read:multimedia']
|
||||
});
|
||||
|
||||
Self.labelBarcodePdf = (ctx, id) => Self.printReport(ctx, id, 'item-label-barcode');
|
||||
};
|
|
@ -1,6 +1,6 @@
|
|||
module.exports = Self => {
|
||||
Self.remoteMethodCtx('itemLabelQr', {
|
||||
description: 'Returns the item label pdf',
|
||||
Self.remoteMethodCtx('labelQrPdf', {
|
||||
description: 'Returns the item label pdf with qr',
|
||||
accessType: 'READ',
|
||||
accepts: [
|
||||
{
|
||||
|
@ -45,11 +45,11 @@ module.exports = Self => {
|
|||
}
|
||||
],
|
||||
http: {
|
||||
path: '/:id/item-label-qr',
|
||||
path: '/:id/label-qr-pdf',
|
||||
verb: 'GET'
|
||||
},
|
||||
accessScopes: ['DEFAULT', 'read:multimedia']
|
||||
});
|
||||
|
||||
Self.itemLabelQr = (ctx, id) => Self.printReport(ctx, id, 'item-label-qr');
|
||||
Self.labelQrPdf = (ctx, id) => Self.printReport(ctx, id, 'item-label-qr');
|
||||
};
|
|
@ -15,7 +15,8 @@ module.exports = Self => {
|
|||
require('../methods/item/getWasteByItem')(Self);
|
||||
require('../methods/item/createIntrastat')(Self);
|
||||
require('../methods/item/buyerWasteEmail')(Self);
|
||||
require('../methods/item/itemLabelQr')(Self);
|
||||
require('../methods/item/labelBarcodePdf')(Self);
|
||||
require('../methods/item/labelQrPdf')(Self);
|
||||
require('../methods/item/setVisibleDiscard')(Self);
|
||||
require('../methods/item/get')(Self);
|
||||
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
const Stylesheet = require(`vn-print/core/stylesheet`);
|
||||
|
||||
const path = require('path');
|
||||
const vnPrintPath = path.resolve('print');
|
||||
|
||||
module.exports = new Stylesheet([
|
||||
`${vnPrintPath}/common/css/spacing.css`,
|
||||
`${vnPrintPath}/common/css/misc.css`,
|
||||
`${vnPrintPath}/common/css/layout.css`,
|
||||
`${vnPrintPath}/common/css/report.css`,
|
||||
`${__dirname}/style.css`])
|
||||
.mergeStyles();
|
|
@ -0,0 +1,83 @@
|
|||
html {
|
||||
font-family: "Roboto", "Helvetica", "Arial", sans-serif;
|
||||
margin-top: -7px;
|
||||
}
|
||||
table {
|
||||
width: 100%;
|
||||
font-size: 14px;
|
||||
}
|
||||
td {
|
||||
border: 6px solid white;
|
||||
}
|
||||
.center {
|
||||
text-align: center;
|
||||
}
|
||||
.right {
|
||||
text-align: right;
|
||||
}
|
||||
.cursive {
|
||||
font-style: italic;
|
||||
}
|
||||
.bold {
|
||||
font-weight: bold;
|
||||
}
|
||||
.black-bg {
|
||||
background-color: black;
|
||||
color: white;
|
||||
}
|
||||
.xs-txt {
|
||||
font-size: 18px;
|
||||
}
|
||||
.md-txt {
|
||||
font-size: 26px;
|
||||
}
|
||||
.xl-txt {
|
||||
font-size: 50px;
|
||||
}
|
||||
.cell {
|
||||
border: 2px solid black;
|
||||
box-sizing: content-box;
|
||||
width: 100%;
|
||||
height: 30px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.padding {
|
||||
padding: 7px;
|
||||
}
|
||||
.xs-height {
|
||||
height: 50px;
|
||||
max-height: 50px;
|
||||
}
|
||||
.md-height {
|
||||
height: 60px;
|
||||
max-height: 60px;
|
||||
}
|
||||
.sm-width {
|
||||
width: 60px;
|
||||
max-width: 60px;
|
||||
}
|
||||
.md-width {
|
||||
width: 120px;
|
||||
max-width: 120px;
|
||||
}
|
||||
.lg-width {
|
||||
width: 400px;
|
||||
max-width: 400px;
|
||||
}
|
||||
.overflow-multiline {
|
||||
max-height: inherit;
|
||||
display: -webkit-box;
|
||||
overflow: hidden;
|
||||
word-wrap: break-word;
|
||||
line-clamp: 2;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
.overflow-line {
|
||||
width: inherit;
|
||||
max-width: inherit;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
}
|
|
@ -0,0 +1,87 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body table v-for="item in items" style="break-before: page">
|
||||
<table>
|
||||
<tr>
|
||||
<td class="md-txt bold center black-bg lg-width md-height">
|
||||
<div class="overflow-multiline">
|
||||
{{item.item}}
|
||||
</div>
|
||||
</td>
|
||||
<td colspan="2" class="xl-txt bold center black-bg md-height">
|
||||
<div class="overflow-line">
|
||||
{{item.size}}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="right lg-width">
|
||||
<div class="overflow-line">
|
||||
{{item.comment}}
|
||||
</div>
|
||||
</td>
|
||||
<td class="center sm-width">
|
||||
<div class="overflow-line">
|
||||
{{item.producer}}
|
||||
</div>
|
||||
</td>
|
||||
<td class="center sm-width">
|
||||
<div class="overflow-line">
|
||||
{{item.inkFk}}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="md-txt xl-width bold center">
|
||||
<div class="overflow-line">
|
||||
{{item.itemFk}}
|
||||
</div>
|
||||
</td>
|
||||
<td colspan="2" class="md-txt md-width center">
|
||||
<div class="overflow-line">
|
||||
{{`${(packing || item.packing)} x ${item.stems || ''}`}}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td rowspan="2" class="center">
|
||||
<div v-html="getBarcode(item.buyFk)"></div>
|
||||
</td>
|
||||
<td colspan="2" class="center md-width xs-height xs-txt">
|
||||
<div class="overflow-line">
|
||||
{{item.entryFk}}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="center xs-txt sm-width">
|
||||
<div class="overflow-line">
|
||||
{{item.buyerName}}
|
||||
</div>
|
||||
</td>
|
||||
<td class="center xs-txt sm-width">
|
||||
<div class="overflow-line">
|
||||
{{item.origin}}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="center xl-width">
|
||||
<div class="overflow-line">
|
||||
{{item.buyFk}}
|
||||
</div>
|
||||
</td>
|
||||
<td class="xs-txt sm-width center">
|
||||
<div class="overflow-line">
|
||||
{{date}}
|
||||
</div>
|
||||
</td>
|
||||
<td class="xs-txt sm-width cursive center bold">
|
||||
<div class="overflow-line">
|
||||
{{`${item.labelNum}/${item.quantity / (packing || item.packing)}`}}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,58 @@
|
|||
const UserError = require('vn-loopback/util/user-error');
|
||||
const {DOMImplementation, XMLSerializer} = require('xmldom');
|
||||
const moment = require('moment');
|
||||
const jsbarcode = require('jsbarcode');
|
||||
|
||||
module.exports = {
|
||||
name: 'item-label-qr',
|
||||
async serverPrefetch() {
|
||||
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.date = moment(this.date).format('WW/E');
|
||||
},
|
||||
methods: {
|
||||
getBarcode(data) {
|
||||
const document = new DOMImplementation().createDocument('http://www.w3.org/1999/xhtml', 'html', null);
|
||||
const svgNode = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
||||
|
||||
jsbarcode(svgNode, data, {
|
||||
xmlDocument: document,
|
||||
format: 'code128',
|
||||
displayValue: false,
|
||||
width: 3.9,
|
||||
height: 85,
|
||||
margin: 0
|
||||
});
|
||||
return new XMLSerializer().serializeToString(svgNode);
|
||||
}
|
||||
},
|
||||
props: {
|
||||
id: {
|
||||
type: Number,
|
||||
required: true,
|
||||
description: 'The item id'
|
||||
},
|
||||
warehouseId: {
|
||||
type: Number
|
||||
},
|
||||
packing: {
|
||||
type: Number
|
||||
},
|
||||
copies: {
|
||||
type: Number
|
||||
},
|
||||
userId: {
|
||||
type: Number
|
||||
}
|
||||
}
|
||||
};
|
|
@ -0,0 +1 @@
|
|||
reportName: Etiqueta de artículo barcode
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"width": "10.4cm",
|
||||
"height": "4.8cm",
|
||||
"margin": {
|
||||
"top": "0.17cm",
|
||||
"right": "0cm",
|
||||
"bottom": "0cm",
|
||||
"left": "0cm"
|
||||
},
|
||||
"printBackground": true
|
||||
}
|
|
@ -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,42 @@
|
|||
WITH RECURSIVE numbers AS (
|
||||
SELECT 1 n
|
||||
UNION ALL
|
||||
SELECT n + 1
|
||||
FROM numbers
|
||||
WHERE n < ?
|
||||
)
|
||||
SELECT ROW_NUMBER() OVER() labelNum,
|
||||
b.id buyFk,
|
||||
b.itemFk,
|
||||
b.quantity,
|
||||
b.packing,
|
||||
b.isPickedOff,
|
||||
b.entryFk,
|
||||
e.sub,
|
||||
o.code origin,
|
||||
COALESCE(p.`name`, p.id, '') producer,
|
||||
i.name item,
|
||||
i.`size`,
|
||||
i.category,
|
||||
i.stems,
|
||||
i.inkFk,
|
||||
IFNULL(CONCAT(ig.longName, ' ', ig.`size`, ' ', ig.subName), i.comment) comment,
|
||||
i.typeFk,
|
||||
i.isLaid,
|
||||
w.code buyerName,
|
||||
w.code,
|
||||
s.company_name companyName,
|
||||
t.shipped
|
||||
FROM vn.buy b
|
||||
JOIN vn.item i ON i.id = b.itemFk
|
||||
LEFT JOIN vn.item ig ON ig.id = b.itemOriginalFk
|
||||
LEFT JOIN edi.ekt e ON e.id = b.ektFk
|
||||
JOIN vn.origin o ON o.id = i.originFk
|
||||
LEFT JOIN vn.producer p ON p.id = i.producerFk
|
||||
JOIN vn.itemType it ON it.id = i.typeFk
|
||||
JOIN vn.worker w ON w.id = it.workerFk
|
||||
LEFT JOIN edi.supplier s ON s.supplier_id = e.pro
|
||||
JOIN vn.entry e2 ON e2.id = b.entryFk
|
||||
JOIN vn.travel t ON t.id = e2.travelFk
|
||||
JOIN numbers num
|
||||
WHERE b.id = ?
|
|
@ -0,0 +1 @@
|
|||
SELECT buy_getUltimate(?, ?, ?) id
|
|
@ -1,6 +1,6 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body table v-for="item in items" style="break-before: page">
|
||||
<body v-for="item in items" style="break-before: page">
|
||||
<table class="leftTable">
|
||||
<tr>
|
||||
<td>
|
||||
|
|
Loading…
Reference in New Issue