diff --git a/db/routines/vn/procedures/setParking.sql b/db/routines/vn/procedures/setParking.sql index 97a40bbe0..d6def07de 100644 --- a/db/routines/vn/procedures/setParking.sql +++ b/db/routines/vn/procedures/setParking.sql @@ -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 ; diff --git a/db/routines/vn/procedures/ticket_splitItemPackingType.sql b/db/routines/vn/procedures/ticket_splitItemPackingType.sql index b28b16432..d6e8e8a53 100644 --- a/db/routines/vn/procedures/ticket_splitItemPackingType.sql +++ b/db/routines/vn/procedures/ticket_splitItemPackingType.sql @@ -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 diff --git a/modules/entry/back/methods/entry/buyLabel.js b/modules/entry/back/methods/entry/buyLabel.js new file mode 100644 index 000000000..650b05c97 --- /dev/null +++ b/modules/entry/back/methods/entry/buyLabel.js @@ -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'); +}; diff --git a/modules/entry/back/models/entry.js b/modules/entry/back/models/entry.js index 6148ae559..6e27e1ece 100644 --- a/modules/entry/back/models/entry.js +++ b/modules/entry/back/models/entry.js @@ -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; diff --git a/modules/worker/back/models/operator.json b/modules/worker/back/models/operator.json index a2f3ee01c..d4832bccf 100644 --- a/modules/worker/back/models/operator.json +++ b/modules/worker/back/models/operator.json @@ -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" - } - } -} + } + } +} \ No newline at end of file diff --git a/print/templates/reports/buy-label/assets/css/import.js b/print/templates/reports/buy-label/assets/css/import.js new file mode 100644 index 000000000..37a98dfdd --- /dev/null +++ b/print/templates/reports/buy-label/assets/css/import.js @@ -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(); diff --git a/print/templates/reports/buy-label/assets/css/style.css b/print/templates/reports/buy-label/assets/css/style.css new file mode 100644 index 000000000..0d4a2891d --- /dev/null +++ b/print/templates/reports/buy-label/assets/css/style.css @@ -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; +} \ No newline at end of file diff --git a/print/templates/reports/buy-label/buy-label.html b/print/templates/reports/buy-label/buy-label.html new file mode 100644 index 000000000..494cdcbc5 --- /dev/null +++ b/print/templates/reports/buy-label/buy-label.html @@ -0,0 +1,89 @@ + + +
+
+ {{$t('variety')}}
+ {{buy.name}}
+
+ |
+
+
+ {{$t('size')}}
+ {{buy.size}}
+
+ |
+ |
+
+ {{$t('category')}}
+ {{buy.category}}
+
+ |
+
+
+ {{$t('color')}}
+ {{buy.color}}
+
+ |
+
+
+ {{$t('origin')}}
+ {{buy.code}}
+
+ |
+
+
+ {{$t('packing')}}
+ {{buy.packing}}
+
+ |
+
+
+ {{$t('grouping')}}
+ {{buy.grouping}}
+
+ |
+
+
+ {{$t('saleUnit')}}
+ {{buy.stems}}
+
+ |
+
+ + {{buy.id}} + | +||
+
+ {{$t('producer')}}
+ {{buy.producer}}
+
+ |
+ ||
+
+ {{$t('control')}}
+ {{`${weekNum} / ${dayNum}`}}
+
+ |
+
+
+ {{$t('boxNum')}}
+ {{`${buy.labelNum} / ${maxLabelNum}`}}
+
+ |
+