parent
6856ab0501
commit
8fe94772f3
|
@ -29,7 +29,8 @@ module.exports = Self => {
|
|||
http: {
|
||||
path: '/:id/buy-label',
|
||||
verb: 'GET'
|
||||
}
|
||||
},
|
||||
accessScopes: ['DEFAULT', 'read:multimedia']
|
||||
});
|
||||
|
||||
Self.buyLabel = (ctx, id) => Self.printReport(ctx, id, 'buy-label');
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
<tr>
|
||||
<td colspan="3" class="barcode">
|
||||
<div v-html="getBarcode(buy.id)"></div>
|
||||
<span>{{buy.id}}</span>
|
||||
<span>{{buy.itemFk}}</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
|
@ -7,7 +7,7 @@ module.exports = {
|
|||
name: 'buy-label',
|
||||
mixins: [vnReport],
|
||||
async serverPrefetch() {
|
||||
this.buys = await this.rawSqlFromDef('buys', [this.id]);
|
||||
this.buys = await this.rawSqlFromDef('buys', [this.id, this.id]);
|
||||
this.maxLabelNum = Math.max(...this.buys.map(buy => buy.labelNum));
|
||||
const date = new Date();
|
||||
this.weekNum = moment(date).isoWeek();
|
||||
|
|
|
@ -1,4 +1,15 @@
|
|||
SELECT ROW_NUMBER() OVER(ORDER BY b.id) labelNum,
|
||||
WITH RECURSIVE numbers AS (
|
||||
SELECT 1 n
|
||||
UNION ALL
|
||||
SELECT n + 1
|
||||
FROM numbers
|
||||
WHERE n < (
|
||||
SELECT MAX(stickers)
|
||||
FROM buy
|
||||
WHERE entryFk = ?
|
||||
)
|
||||
)
|
||||
SELECT ROW_NUMBER() OVER(ORDER BY b.id, num.n) labelNum,
|
||||
i.name,
|
||||
i.`size`,
|
||||
i.category,
|
||||
|
@ -8,10 +19,13 @@ SELECT ROW_NUMBER() OVER(ORDER BY b.id) labelNum,
|
|||
b.`grouping`,
|
||||
i.stems,
|
||||
b.id,
|
||||
b.itemFk,
|
||||
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
|
||||
JOIN numbers num
|
||||
WHERE b.entryFk = ?
|
||||
AND num.n <= b.stickers
|
||||
|
|
Loading…
Reference in New Issue