feat setParking refs #7580 #2653
|
@ -22,40 +22,42 @@ proc: BEGIN
|
|||
CALL util.throw('parkingNotExist');
|
||||
LEAVE proc;
|
||||
END IF;
|
||||
|
||||
IF vParam REGEXP '^[0-9]+$' THEN
|
||||
-- Se comprueba si es una preparación previa
|
||||
SELECT COUNT(*) INTO vIsSaleGroup
|
||||
FROM vn.saleGroup sg
|
||||
WHERE sg.id = vParam;
|
||||
|
||||
-- Se comprueba si es una preparación previa
|
||||
SELECT COUNT(*) INTO vIsSaleGroup
|
||||
FROM vn.saleGroup sg
|
||||
WHERE sg.id = vParam;
|
||||
IF vIsSaleGroup THEN
|
||||
CALL vn.saleGroup_setParking(vParam, vParkingFk);
|
||||
LEAVE proc;
|
||||
END IF;
|
||||
|
||||
IF vIsSaleGroup THEN
|
||||
CALL vn.saleGroup_setParking(vParam, vParkingFk);
|
||||
LEAVE proc;
|
||||
-- Se comprueba si es un ticket
|
||||
SELECT COUNT(*) INTO vIsTicket
|
||||
FROM vn.ticket t
|
||||
WHERE t.id = vParam
|
||||
AND t.shipped >= TIMESTAMPADD(WEEK,-1,util.VN_CURDATE());
|
||||
|
||||
IF vIsTicket THEN
|
||||
CALL vn.ticket_setParking(vParam, vParkingFk);
|
||||
LEAVE proc;
|
||||
END IF;
|
||||
|
||||
-- Se comprueba si es una coleccion de tickets
|
||||
SELECT COUNT(*) INTO vIsCollection
|
||||
FROM vn.collection c
|
||||
WHERE c.id = vParam
|
||||
AND c.created >= TIMESTAMPADD(WEEK,-1,util.VN_CURDATE());
|
||||
|
||||
IF vIsCollection THEN
|
||||
CALL vn.collection_setParking(vParam, vParkingFk);
|
||||
LEAVE proc;
|
||||
END IF;
|
||||
ELSE
|
||||
-- Por descarte, se considera una matrícula
|
||||
CALL vn.shelving_setParking(vParam, vParkingFk);
|
||||
END IF;
|
||||
|
||||
-- Se comprueba si es un ticket
|
||||
SELECT COUNT(*) INTO vIsTicket
|
||||
FROM vn.ticket t
|
||||
WHERE t.id = vParam
|
||||
AND t.shipped >= TIMESTAMPADD(WEEK,-1,util.VN_CURDATE());
|
||||
|
||||
IF vIsTicket THEN
|
||||
CALL vn.ticket_setParking(vParam, vParkingFk);
|
||||
LEAVE proc;
|
||||
END IF;
|
||||
|
||||
-- Se comprueba si es una coleccion de tickets
|
||||
SELECT COUNT(*) INTO vIsCollection
|
||||
FROM vn.collection c
|
||||
WHERE c.id = vParam
|
||||
AND c.created >= TIMESTAMPADD(WEEK,-1,util.VN_CURDATE());
|
||||
|
||||
IF vIsCollection THEN
|
||||
CALL vn.collection_setParking(vParam, vParkingFk);
|
||||
LEAVE proc;
|
||||
END IF;
|
||||
|
||||
-- Por descarte, se considera una matrícula
|
||||
CALL vn.shelving_setParking(vParam, vParkingFk);
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -44,7 +44,6 @@ BEGIN
|
|||
WHERE s.ticketFk = vTicketFk;
|
||||
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.saleGroup
|
||||
(PRIMARY KEY (itemPackingTypeFk))
|
||||
ENGINE = MEMORY
|
||||
SELECT itemPackingTypeFk, SUM(litros) totalLitros
|
||||
FROM tmp.sale
|
||||
|
@ -56,8 +55,7 @@ BEGIN
|
|||
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.ticketIPT (
|
||||
ticketFk INT,
|
||||
itemPackingTypeFk VARCHAR(1),
|
||||
PRIMARY KEY (ticketFk)
|
||||
itemPackingTypeFk VARCHAR(1)
|
||||
) ENGINE = MEMORY;
|
||||
|
||||
CASE vPackingTypesToSplit
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
module.exports = Self => {
|
||||
Self.remoteMethodCtx('buyLabel', {
|
||||
description: 'Returns the entry buys labels',
|
||||
accessType: 'READ',
|
||||
accepts: [
|
||||
{
|
||||
arg: 'id',
|
||||
type: 'number',
|
||||
required: true,
|
||||
description: 'The entry id',
|
||||
http: {source: 'path'}
|
||||
}
|
||||
],
|
||||
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/buy-label',
|
||||
verb: 'GET'
|
||||
}
|
||||
});
|
||||
|
||||
Self.buyLabel = (ctx, id) => Self.printReport(ctx, id, 'buy-label');
|
||||
};
|
|
@ -9,6 +9,7 @@ module.exports = Self => {
|
|||
require('../methods/entry/entryOrderPdf')(Self);
|
||||
require('../methods/entry/addFromPackaging')(Self);
|
||||
require('../methods/entry/addFromBuy')(Self);
|
||||
require('../methods/entry/buyLabel')(Self);
|
||||
|
||||
Self.observe('before save', async function(ctx, options) {
|
||||
if (ctx.isNewInstance) return;
|
||||
|
|
|
@ -26,29 +26,33 @@
|
|||
},
|
||||
"labelerFk": {
|
||||
"type": "number"
|
||||
},
|
||||
"isOnReservationMode": {
|
||||
"type": "boolean",
|
||||
"required": true
|
||||
}
|
||||
},
|
||||
},
|
||||
"relations": {
|
||||
"sector": {
|
||||
"type": "belongsTo",
|
||||
"model": "Sector",
|
||||
"foreignKey": "sectorFk"
|
||||
},
|
||||
"sector": {
|
||||
"type": "belongsTo",
|
||||
"model": "Sector",
|
||||
"foreignKey": "sectorFk"
|
||||
},
|
||||
"train": {
|
||||
"type": "belongsTo",
|
||||
"model": "Train",
|
||||
"foreignKey": "trainFk"
|
||||
},
|
||||
"type": "belongsTo",
|
||||
"model": "Train",
|
||||
"foreignKey": "trainFk"
|
||||
},
|
||||
"printer": {
|
||||
"type": "belongsTo",
|
||||
"model": "Printer",
|
||||
"foreignKey": "labelerFk"
|
||||
},
|
||||
"type": "belongsTo",
|
||||
"model": "Printer",
|
||||
"foreignKey": "labelerFk"
|
||||
},
|
||||
"itemPackingType": {
|
||||
"type": "belongsTo",
|
||||
"model": "ItemPackingType",
|
||||
"foreignKey": "itemPackingTypeFk",
|
||||
"type": "belongsTo",
|
||||
"model": "ItemPackingType",
|
||||
"foreignKey": "itemPackingTypeFk",
|
||||
"primaryKey": "code"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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,41 @@
|
|||
html {
|
||||
font-family: "Roboto", "Helvetica", "Arial", sans-serif;
|
||||
margin-top: -7px;
|
||||
font-size: 28px;
|
||||
}
|
||||
table {
|
||||
border: 1px solid;
|
||||
width: 100%;
|
||||
font-size: inherit;
|
||||
}
|
||||
td {
|
||||
border: 1px solid;
|
||||
padding: 5px;
|
||||
width: 100%;
|
||||
}
|
||||
span {
|
||||
font-size: 48px;
|
||||
font-weight: bold;
|
||||
}
|
||||
.lbl {
|
||||
color: gray;
|
||||
font-weight: lighter;
|
||||
font-size: 18px;
|
||||
display: block;
|
||||
}
|
||||
.cell {
|
||||
width: 157px;
|
||||
height: 50px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.barcode {
|
||||
text-align: center;
|
||||
}
|
||||
#variant {
|
||||
width: 314px;
|
||||
}
|
||||
#producer {
|
||||
width: 471px;
|
||||
}
|
|
@ -0,0 +1,89 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<table v-for="buy in buys" style="break-before: page">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<div id="variant" class="cell">
|
||||
<span class="lbl">{{$t('variety')}}</span>
|
||||
{{buy.name}}
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="cell">
|
||||
<span class="lbl">{{$t('size')}}</span>
|
||||
{{buy.size}}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="cell">
|
||||
<span class="lbl">{{$t('category')}}</span>
|
||||
{{buy.category}}
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="cell">
|
||||
<span class="lbl">{{$t('color')}}</span>
|
||||
{{buy.color}}
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="cell">
|
||||
<span class="lbl">{{$t('origin')}}</span>
|
||||
{{buy.code}}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="cell">
|
||||
<span class="lbl">{{$t('packing')}}</span>
|
||||
{{buy.packing}}
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="cell">
|
||||
<span class="lbl">{{$t('grouping')}}</span>
|
||||
{{buy.grouping}}
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="cell">
|
||||
<span class="lbl">{{$t('saleUnit')}}</span>
|
||||
{{buy.stems}}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3" class="barcode">
|
||||
<div v-html="getBarcode(buy.id)"></div>
|
||||
<span>{{buy.id}}</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<div id="producer" class="cell">
|
||||
<span class="lbl">{{$t('producer')}}</span>
|
||||
{{buy.producer}}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<div class="cell">
|
||||
<span class="lbl">{{$t('control')}}</span>
|
||||
{{`${weekNum} / ${dayNum}`}}
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="cell">
|
||||
<span class="lbl">{{$t('boxNum')}}</span>
|
||||
{{`${buy.labelNum} / ${maxLabelNum}`}}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</html>
|
|
@ -0,0 +1,39 @@
|
|||
const vnReport = require('../../../core/mixins/vn-report.js');
|
||||
const {DOMImplementation, XMLSerializer} = require('xmldom');
|
||||
const jsBarcode = require('jsbarcode');
|
||||
const moment = require('moment');
|
||||
|
||||
module.exports = {
|
||||
name: 'buy-label',
|
||||
mixins: [vnReport],
|
||||
async serverPrefetch() {
|
||||
this.buys = await this.rawSqlFromDef('buys', [this.id]);
|
||||
this.maxLabelNum = Math.max(...this.buys.map(buy => buy.labelNum));
|
||||
const date = new Date();
|
||||
this.weekNum = moment(date).isoWeek();
|
||||
this.dayNum = moment(date).day();
|
||||
},
|
||||
methods: {
|
||||
getBarcode(id) {
|
||||
const xmlSerializer = new XMLSerializer();
|
||||
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, id, {
|
||||
xmlDocument: document,
|
||||
format: 'code128',
|
||||
displayValue: false,
|
||||
width: 3.8,
|
||||
height: 115,
|
||||
});
|
||||
return xmlSerializer.serializeToString(svgNode);
|
||||
}
|
||||
},
|
||||
props: {
|
||||
id: {
|
||||
type: Number,
|
||||
required: true,
|
||||
description: 'The entry id'
|
||||
}
|
||||
}
|
||||
};
|
|
@ -0,0 +1,12 @@
|
|||
reportName: Entry buys
|
||||
variety: Bariety
|
||||
size: Size
|
||||
category: Category
|
||||
color: Color
|
||||
origin: Origin
|
||||
packing: Packing
|
||||
grouping: Grouping
|
||||
unitSale: Un. sale
|
||||
producer: Producer
|
||||
control: Control
|
||||
boxNum: Box no.
|
|
@ -0,0 +1,12 @@
|
|||
reportName: Etiqueta de compras
|
||||
variety: Variedad
|
||||
size: Medida
|
||||
category: Categoría
|
||||
color: Color
|
||||
origin: Origen
|
||||
packing: Packing
|
||||
grouping: Grouping
|
||||
saleUnit: Sale un.
|
||||
producer: Productor
|
||||
control: Control
|
||||
boxNum: Caja nº
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"width": "10cm",
|
||||
"height": "10cm",
|
||||
"margin": {
|
||||
"top": "0.17cm",
|
||||
"right": "0.2cm",
|
||||
"bottom": "0cm",
|
||||
"left": "0cm"
|
||||
},
|
||||
"printBackground": true
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
SELECT ROW_NUMBER() OVER(ORDER BY b.id) labelNum,
|
||||
i.name,
|
||||
i.`size`,
|
||||
i.category,
|
||||
ink.id color,
|
||||
o.code,
|
||||
b.packing,
|
||||
b.`grouping`,
|
||||
i.stems,
|
||||
b.id,
|
||||
p.name producer
|
||||
FROM buy b
|
||||
JOIN item i ON i.id = b.itemFk
|
||||
LEFT JOIN producer p ON p.id = i.producerFk
|
||||
LEFT JOIN ink ON ink.id = i.inkFk
|
||||
LEFT JOIN origin o ON o.id = i.originFk
|
||||
WHERE b.entryFk = ?
|
Loading…
Reference in New Issue