diff --git a/db/routines/vn/procedures/expedition_getFromRoute.sql b/db/routines/vn/procedures/expedition_getFromRoute.sql index f95936413..8c2ab057d 100644 --- a/db/routines/vn/procedures/expedition_getFromRoute.sql +++ b/db/routines/vn/procedures/expedition_getFromRoute.sql @@ -16,7 +16,8 @@ BEGIN a.nickname, sub2.itemPackingTypeConcat, est.code, - es.isScanned + es2.isScanned, + es2.scanOrder FROM expedition e JOIN ticket t ON t.id = e.ticketFk JOIN ticketState ts ON ts.ticketFk = e.ticketFk @@ -38,6 +39,7 @@ BEGIN SELECT MAX(id) FROM expeditionState es WHERE expeditionFk = e.id) + LEFT JOIN expeditionState es2 ON es2.id = es.id WHERE t.routeFk = vRouteFk AND e.freightItemFk <> FALSE ORDER BY r.created, t.priority DESC; END$$ diff --git a/db/routines/vn/procedures/travel_cloneWithEntries.sql b/db/routines/vn/procedures/travel_cloneWithEntries.sql index ee26aea32..5b2958edc 100644 --- a/db/routines/vn/procedures/travel_cloneWithEntries.sql +++ b/db/routines/vn/procedures/travel_cloneWithEntries.sql @@ -62,7 +62,7 @@ BEGIN END IF; CALL entry_cloneHeader(vAuxEntryFk, vNewEntryFk, vNewTravelFk); - CALL entry_copyBuys(vAuxEntryFk, vNewEntryFk); + CALL entry_copyBuys(vAuxEntryFk, vNewEntryFk); SELECT evaNotes INTO vEvaNotes FROM entry @@ -71,6 +71,8 @@ BEGIN UPDATE entry SET evaNotes = vEvaNotes WHERE id = vNewEntryFk; + + CALL buy_recalcPricesByEntry(vNewEntryFk); END LOOP; SET @isModeInventory = FALSE; diff --git a/db/versions/11319-redEucalyptus/00-firstScript.sql b/db/versions/11319-redEucalyptus/00-firstScript.sql new file mode 100644 index 000000000..62bd64f4a --- /dev/null +++ b/db/versions/11319-redEucalyptus/00-firstScript.sql @@ -0,0 +1,3 @@ +USE vn; + +ALTER TABLE vn.expeditionState ADD scanOrder int(11) DEFAULT NULL NULL COMMENT 'Indica la posiciĆ³n al cargar la furgoneta'; diff --git a/db/versions/11325-navyEucalyptus/00-firstScript.sql b/db/versions/11325-navyEucalyptus/00-firstScript.sql new file mode 100644 index 000000000..8bc4bd82b --- /dev/null +++ b/db/versions/11325-navyEucalyptus/00-firstScript.sql @@ -0,0 +1,7 @@ +UPDATE salix.ACL + SET property='buyLabelSupplier' + WHERE property = 'buyLabel' + AND model = 'Entry'; + +INSERT IGNORE INTO salix.ACL (model,property,principalId) + VALUES ('Entry','buyLabel','employee'); diff --git a/db/versions/11326-limeOrchid/00-firstScript.sql b/db/versions/11326-limeOrchid/00-firstScript.sql new file mode 100644 index 000000000..afec99459 --- /dev/null +++ b/db/versions/11326-limeOrchid/00-firstScript.sql @@ -0,0 +1,7 @@ +DELETE FROM vn.report + WHERE `name` = 'LabelItemQr'; + +UPDATE vn.report + SET `method` = 'Entries/{id}/{itemType}/buy-label', + `name` = 'LabelBuy' + WHERE `name` = 'LabelItemBarcode'; diff --git a/modules/entry/back/methods/entry/buyLabel.js b/modules/entry/back/methods/entry/buyLabel.js index 919f7c4d7..fb807fb5f 100644 --- a/modules/entry/back/methods/entry/buyLabel.js +++ b/modules/entry/back/methods/entry/buyLabel.js @@ -1,14 +1,28 @@ module.exports = Self => { Self.remoteMethodCtx('buyLabel', { - description: 'Returns the entry buy labels', + description: 'Returns the buy label', accessType: 'READ', accepts: [ { arg: 'id', type: 'number', required: true, - description: 'The entry id', + description: 'The buy id', http: {source: 'path'} + }, { + arg: 'labelType', + type: 'string', + required: true, + description: 'The label type', + http: {source: 'path'} + }, { + arg: 'packing', + type: 'number', + required: false + }, { + arg: 'copies', + type: 'number', + required: false } ], returns: [ @@ -27,11 +41,16 @@ module.exports = Self => { } ], http: { - path: '/:id/buy-label', + path: '/:id/:labelType/buy-label', verb: 'GET' }, accessScopes: ['DEFAULT', 'read:multimedia'] }); - Self.buyLabel = (ctx, id) => Self.printReport(ctx, id, 'buy-label'); + Self.buyLabel = (ctx, id, labelType) => { + if (labelType == 'qr') + return Self.printReport(ctx, id, 'buy-label-qr'); + else + return Self.printReport(ctx, id, 'buy-label-barcode'); + }; }; diff --git a/modules/entry/back/methods/entry/buyLabelSupplier.js b/modules/entry/back/methods/entry/buyLabelSupplier.js new file mode 100644 index 000000000..61938f2f8 --- /dev/null +++ b/modules/entry/back/methods/entry/buyLabelSupplier.js @@ -0,0 +1,37 @@ +module.exports = Self => { + Self.remoteMethodCtx('buyLabelSupplier', { + description: 'Returns the entry buy 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-supplier', + verb: 'GET' + }, + accessScopes: ['DEFAULT', 'read:multimedia'] + }); + + Self.buyLabelSupplier = (ctx, id) => Self.printReport(ctx, id, 'buy-label-supplier'); +}; diff --git a/modules/entry/back/models/buy.js b/modules/entry/back/models/buy.js index 34f19e765..a027a861e 100644 --- a/modules/entry/back/models/buy.js +++ b/modules/entry/back/models/buy.js @@ -2,4 +2,5 @@ module.exports = Self => { require('../methods/entry/editLatestBuys')(Self); require('../methods/entry/latestBuysFilter')(Self); require('../methods/entry/deleteBuys')(Self); + require('../methods/entry/buyLabel')(Self); }; diff --git a/modules/item/back/methods/item/labelBarcodePdf.js b/modules/item/back/methods/item/labelBarcodePdf.js deleted file mode 100644 index 3325e3da1..000000000 --- a/modules/item/back/methods/item/labelBarcodePdf.js +++ /dev/null @@ -1,55 +0,0 @@ -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'); -}; diff --git a/modules/item/back/methods/item/labelQrPdf.js b/modules/item/back/methods/item/labelQrPdf.js deleted file mode 100644 index 4d0e34528..000000000 --- a/modules/item/back/methods/item/labelQrPdf.js +++ /dev/null @@ -1,55 +0,0 @@ -module.exports = Self => { - Self.remoteMethodCtx('labelQrPdf', { - description: 'Returns the item label pdf with qr', - 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-qr-pdf', - verb: 'GET' - }, - accessScopes: ['DEFAULT', 'read:multimedia'] - }); - - Self.labelQrPdf = (ctx, id) => Self.printReport(ctx, id, 'item-label-qr'); -}; diff --git a/modules/item/back/models/item.js b/modules/item/back/models/item.js index d39586a90..44a51594c 100644 --- a/modules/item/back/models/item.js +++ b/modules/item/back/models/item.js @@ -15,8 +15,6 @@ module.exports = Self => { require('../methods/item/getWasteByItem')(Self); require('../methods/item/createIntrastat')(Self); require('../methods/item/buyerWasteEmail')(Self); - require('../methods/item/labelBarcodePdf')(Self); - require('../methods/item/labelQrPdf')(Self); require('../methods/item/setVisibleDiscard')(Self); require('../methods/item/get')(Self); diff --git a/modules/ticket/back/methods/expedition-state/addExpeditionState.js b/modules/ticket/back/methods/expedition-state/addExpeditionState.js index 80d74ee92..0ba402ff7 100644 --- a/modules/ticket/back/methods/expedition-state/addExpeditionState.js +++ b/modules/ticket/back/methods/expedition-state/addExpeditionState.js @@ -44,6 +44,7 @@ module.exports = Self => { const typeFk = expeditionStateType.id; expeditionId = expedition.expeditionFk; + expeditionPosition = expedition?.scanOrder ?? null; const isScannedExpedition = expedition.isScanned ?? false; await models.ExpeditionState.create({ @@ -51,6 +52,7 @@ module.exports = Self => { typeFk, userFk: userId, isScanned: isScannedExpedition, + scanOrder: expeditionPosition }, myOptions); } diff --git a/modules/ticket/back/models/expedition-state.json b/modules/ticket/back/models/expedition-state.json index 522327031..7d8079b33 100644 --- a/modules/ticket/back/models/expedition-state.json +++ b/modules/ticket/back/models/expedition-state.json @@ -27,6 +27,9 @@ }, "isScanned": { "type": "boolean" + }, + "scanOrder": { + "type": "number" } }, "relations": { diff --git a/print/templates/reports/buy-label/assets/css/import.js b/print/templates/reports/buy-label-barcode/assets/css/import.js similarity index 100% rename from print/templates/reports/buy-label/assets/css/import.js rename to print/templates/reports/buy-label-barcode/assets/css/import.js diff --git a/print/templates/reports/item-label-barcode/assets/css/style.css b/print/templates/reports/buy-label-barcode/assets/css/style.css similarity index 95% rename from print/templates/reports/item-label-barcode/assets/css/style.css rename to print/templates/reports/buy-label-barcode/assets/css/style.css index 884faef56..fabecd28e 100644 --- a/print/templates/reports/item-label-barcode/assets/css/style.css +++ b/print/templates/reports/buy-label-barcode/assets/css/style.css @@ -1,7 +1,7 @@ html { font-family: "Roboto", "Helvetica", "Arial", sans-serif; margin-top: -9px; - margin-left: -6px; + margin-left: -3px; } table { width: 100%; @@ -52,8 +52,8 @@ td { max-height: 50px; } .md-height { - height: 75px; - max-height: 75px; + height: 70px; + max-height: 70px; } .sm-width { width: 60px; diff --git a/print/templates/reports/item-label-barcode/item-label-barcode.html b/print/templates/reports/buy-label-barcode/buy-label-barcode.html similarity index 67% rename from print/templates/reports/item-label-barcode/item-label-barcode.html rename to print/templates/reports/buy-label-barcode/buy-label-barcode.html index 929ce5fe2..f14f0b70b 100644 --- a/print/templates/reports/item-label-barcode/item-label-barcode.html +++ b/print/templates/reports/buy-label-barcode/buy-label-barcode.html @@ -1,16 +1,16 @@ -
+
- {{item.item}}
+ {{buy.item}}
|
- {{item.size}}
+ {{buy.size}}
|
{{
- (item.longName && item.size && item.subName)
- ? `${item.longName} ${item.size} ${item.subName}`
- : item.comment
+ (buy.longName && buy.size && buy.subName)
+ ? `${buy.longName} ${buy.size} ${buy.subName}`
+ : buy.comment
}}
|
- {{item.producerName || item.producerFk}}
+ {{buy.producerName || buy.producerFk}}
|
- {{item.inkFk}}
+ {{buy.inkFk}}
|
- {{item.itemFk}}
+ {{buy.itemFk}}
|
- {{`${(packing || item.packing)} x ${item.stems || ''}`}}
+ {{`${(packing || buy.packing)} x ${buy.stems || ''}`}}
|
||
- + |
-
- {{item.entryFk}}
+
+ {{'LAID'}}
+
+
+ {{buy.entryFk}}
|
||
- {{item.buyerName}}
+ {{buy.buyerName}}
|
- {{item.origin}}
+ {{buy.origin}}
|
||
- {{item.buyFk}}
+ {{buy.buyFk}}
|
@@ -82,7 +85,7 @@ |
- {{`${item.labelNum}/${item.quantity / (packing || item.packing)}`}}
+ {{`${buy.labelNum}/${buy.quantity / (packing || buy.packing)}`}}
|
@@ -12,7 +12,7 @@ | |||
- {{item.buyFk}} + {{buy.buyFk}} | |||
- {{item.itemFk}}
+ {{buy.itemFk}}
|
|||
- {{item.item}}
+ {{buy.item}}
|
- {{item.size}}
+ {{buy.size}}
|
||
- Color: {{item.inkFk}}
+ Color: {{buy.inkFk}}
|
- {{packing || item.packing}}
+ {{packing || buy.packing}}
|
- {{item.stems}}
+ {{buy.stems}}
|
|
- Origen: {{item.origin}}
+ Origen: {{buy.origin}}
|
|||
- Productor: {{item.producerName || item.producerFk}}
+ Productor: {{buy.producerName || buy.producerFk}}
+
+ |
+
+
+ {{'LAID'}}
+
+
+ {{buy.entryFk}}
|
- ||
- Comprador: {{item.buyerName}}
+ Comprador: {{buy.buyerName}}
|
@@ -89,14 +96,14 @@ |
- {{`${item.labelNum}/${item.quantity / (packing || item.packing)}`}}
+ {{`${buy.labelNum}/${buy.quantity / (packing || buy.packing)}`}}
|
|
- Entrada: {{item.entryFk}}
+ Entrada: {{buy.entryFk}}
|
{{
- (item.longName && item.size && item.subName)
- ? `${item.longName} ${item.size} ${item.subName}`
- : item.comment
+ (buy.longName && buy.size && buy.subName)
+ ? `${buy.longName} ${buy.size} ${buy.subName}`
+ : buy.comment
}}
|
diff --git a/print/templates/reports/item-label-qr/item-label-qr.js b/print/templates/reports/buy-label-qr/buy-label-qr.js
similarity index 61%
rename from print/templates/reports/item-label-qr/item-label-qr.js
rename to print/templates/reports/buy-label-qr/buy-label-qr.js
index 1a0ef767b..74470ad6d 100755
--- a/print/templates/reports/item-label-qr/item-label-qr.js
+++ b/print/templates/reports/buy-label-qr/buy-label-qr.js
@@ -3,27 +3,18 @@ const moment = require('moment');
const qrcode = require('qrcode');
module.exports = {
- name: 'item-label-qr',
+ name: 'buy-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.qr = await this.getQr(this.items[0].buyFk);
+ 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');
},
methods: {
getQr(data) {
data = {
- company: this.company,
+ company: this.buys.company,
user: this.userId,
created: this.date,
table: 'buy',
@@ -52,6 +43,9 @@ module.exports = {
},
userId: {
type: Number
+ },
+ typeId: {
+ type: String
}
}
};
diff --git a/print/templates/reports/item-label-qr/locale/es.yml b/print/templates/reports/buy-label-qr/locale/es.yml
similarity index 100%
rename from print/templates/reports/item-label-qr/locale/es.yml
rename to print/templates/reports/buy-label-qr/locale/es.yml
diff --git a/print/templates/reports/item-label-qr/options.json b/print/templates/reports/buy-label-qr/options.json
similarity index 86%
rename from print/templates/reports/item-label-qr/options.json
rename to print/templates/reports/buy-label-qr/options.json
index c3c395040..c6ffaddea 100644
--- a/print/templates/reports/item-label-qr/options.json
+++ b/print/templates/reports/buy-label-qr/options.json
@@ -3,7 +3,7 @@
"height": "4.9cm",
"margin": {
"top": "0.17cm",
- "right": "0.6cm",
+ "right": "0.3cm",
"bottom": "0cm",
"left": "0cm"
},
diff --git a/print/templates/reports/item-label-qr/sql/item.sql b/print/templates/reports/buy-label-qr/sql/buy.sql
similarity index 82%
rename from print/templates/reports/item-label-qr/sql/item.sql
rename to print/templates/reports/buy-label-qr/sql/buy.sql
index 3cb42d139..739f8449f 100644
--- a/print/templates/reports/item-label-qr/sql/item.sql
+++ b/print/templates/reports/buy-label-qr/sql/buy.sql
@@ -22,7 +22,9 @@ SELECT ROW_NUMBER() OVER() labelNum,
ig.longName,
ig.subName,
i.comment,
- w.code buyerName
+ w.code buyerName,
+ i.isLaid,
+ c.code company
FROM vn.buy b
JOIN vn.item i ON i.id = b.itemFk
LEFT JOIN vn.item ig ON ig.id = b.itemOriginalFk
@@ -30,5 +32,7 @@ SELECT ROW_NUMBER() OVER() labelNum,
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
+ JOIN vn.entry e ON e.id = b.entryFk
+ JOIN vn.company c ON c.id = e.companyFk
JOIN numbers num
WHERE b.id = ?
\ No newline at end of file
diff --git a/print/templates/reports/item-label-qr/assets/css/import.js b/print/templates/reports/buy-label-supplier/assets/css/import.js
similarity index 100%
rename from print/templates/reports/item-label-qr/assets/css/import.js
rename to print/templates/reports/buy-label-supplier/assets/css/import.js
diff --git a/print/templates/reports/buy-label/assets/css/style.css b/print/templates/reports/buy-label-supplier/assets/css/style.css
similarity index 100%
rename from print/templates/reports/buy-label/assets/css/style.css
rename to print/templates/reports/buy-label-supplier/assets/css/style.css
diff --git a/print/templates/reports/buy-label/buy-label.html b/print/templates/reports/buy-label-supplier/buy-label-supplier.html
similarity index 100%
rename from print/templates/reports/buy-label/buy-label.html
rename to print/templates/reports/buy-label-supplier/buy-label-supplier.html
diff --git a/print/templates/reports/buy-label/buy-label.js b/print/templates/reports/buy-label-supplier/buy-label-supplier.js
similarity index 97%
rename from print/templates/reports/buy-label/buy-label.js
rename to print/templates/reports/buy-label-supplier/buy-label-supplier.js
index 289483051..3cef5f295 100755
--- a/print/templates/reports/buy-label/buy-label.js
+++ b/print/templates/reports/buy-label-supplier/buy-label-supplier.js
@@ -5,7 +5,7 @@ const jsBarcode = require('jsbarcode');
const moment = require('moment');
module.exports = {
- name: 'buy-label',
+ name: 'buy-label-supplier',
mixins: [vnReport],
async serverPrefetch() {
const buy = await models.Buy.findById(this.id, null);
diff --git a/print/templates/reports/buy-label/locale/en.yml b/print/templates/reports/buy-label-supplier/locale/en.yml
similarity index 100%
rename from print/templates/reports/buy-label/locale/en.yml
rename to print/templates/reports/buy-label-supplier/locale/en.yml
diff --git a/print/templates/reports/buy-label/locale/es.yml b/print/templates/reports/buy-label-supplier/locale/es.yml
similarity index 100%
rename from print/templates/reports/buy-label/locale/es.yml
rename to print/templates/reports/buy-label-supplier/locale/es.yml
diff --git a/print/templates/reports/buy-label/options.json b/print/templates/reports/buy-label-supplier/options.json
similarity index 100%
rename from print/templates/reports/buy-label/options.json
rename to print/templates/reports/buy-label-supplier/options.json
diff --git a/print/templates/reports/buy-label/sql/buy.sql b/print/templates/reports/buy-label-supplier/sql/buy.sql
similarity index 100%
rename from print/templates/reports/buy-label/sql/buy.sql
rename to print/templates/reports/buy-label-supplier/sql/buy.sql
diff --git a/print/templates/reports/item-label-barcode/sql/company.sql b/print/templates/reports/item-label-barcode/sql/company.sql
deleted file mode 100644
index 4047786a9..000000000
--- a/print/templates/reports/item-label-barcode/sql/company.sql
+++ /dev/null
@@ -1,5 +0,0 @@
-SELECT co.code
- FROM warehouse w
- JOIN address a ON a.id = w.addressFk
- JOIN company co ON co.clientFk = a.clientFk
- WHERE w.id = ?
\ No newline at end of file
diff --git a/print/templates/reports/item-label-barcode/sql/lastBuy.sql b/print/templates/reports/item-label-barcode/sql/lastBuy.sql
deleted file mode 100644
index d10339998..000000000
--- a/print/templates/reports/item-label-barcode/sql/lastBuy.sql
+++ /dev/null
@@ -1 +0,0 @@
-SELECT buy_getUltimate(?, ?, ?) id
\ No newline at end of file
diff --git a/print/templates/reports/item-label-qr/sql/company.sql b/print/templates/reports/item-label-qr/sql/company.sql
deleted file mode 100644
index 4047786a9..000000000
--- a/print/templates/reports/item-label-qr/sql/company.sql
+++ /dev/null
@@ -1,5 +0,0 @@
-SELECT co.code
- FROM warehouse w
- JOIN address a ON a.id = w.addressFk
- JOIN company co ON co.clientFk = a.clientFk
- WHERE w.id = ?
\ No newline at end of file
diff --git a/print/templates/reports/item-label-qr/sql/lastBuy.sql b/print/templates/reports/item-label-qr/sql/lastBuy.sql
deleted file mode 100644
index d10339998..000000000
--- a/print/templates/reports/item-label-qr/sql/lastBuy.sql
+++ /dev/null
@@ -1 +0,0 @@
-SELECT buy_getUltimate(?, ?, ?) id
\ No newline at end of file