diff --git a/back/methods/collection/getTickets.js b/back/methods/collection/getTickets.js index 693358fb0..3c2f6cb2d 100644 --- a/back/methods/collection/getTickets.js +++ b/back/methods/collection/getTickets.js @@ -57,10 +57,10 @@ module.exports = Self => { ROW_NUMBER () OVER (PARTITION BY s.id ORDER BY pickingOrder) currentItemShelving, COUNT(*) OVER (PARTITION BY s.id ORDER BY s.id) totalItemShelving, sh.code, - p2.code parkingCode, - p2.pickingOrder pickingOrder, - p.code parkingCodePrevia, - p.pickingOrder pickingOrderPrevia, + p2.code parkingCodePrevia, + p2.pickingOrder pickingOrderPrevia, + p.code parkingCode, + p.pickingOrder pickingOrder, iss.id itemShelvingSaleFk, iss.isPicked, iss.itemShelvingFk diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index eb376b6c6..48e886ac9 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -4008,6 +4008,10 @@ INSERT IGNORE INTO pbx.queueMember UPDATE vn.department SET pbxQueue = '1000' WHERE name = "CAMARA"; UPDATE vn.department SET pbxQueue = '2000' WHERE name = "VENTAS"; +INSERT INTO vn.routeAction (id, name, price, isMainlineDelivered) VALUES(1, 'Pintar traje', 50.00, 0); +INSERT INTO vn.routeComplement (id, dated, workerFk, price, routeActionFk) VALUES(1, util.VN_CURDATE(), 9, 50.00, 1); + + INSERT INTO srt.buffer (id, x, y, `size`, `length`, stateFk, typeFk, isActive, code, stratus, hasWorkerWaiting, reserve, routeFk, dayMinute, lastUnloaded, hasStrapper, typeDefaultFk, motors, editorFk) VALUES (0, 0, 0, 0, NULL, 3, 1, 0, 'ENT', 0, 0, NULL, NULL, NULL, NULL, 0, 1, 1, NULL), (1, 0, 9900, 0, NULL, 1, 0, 0, 'NOK', 0, 0, NULL, NULL, NULL, NULL, 0, 1, 1, NULL), diff --git a/db/routines/vn/functions/address_getGeo.sql b/db/routines/vn/functions/address_getGeo.sql index 0800d226a..213eb91c3 100644 --- a/db/routines/vn/functions/address_getGeo.sql +++ b/db/routines/vn/functions/address_getGeo.sql @@ -15,6 +15,7 @@ BEGIN FROM address a JOIN town t ON t.provinceFk = a.provinceFk JOIN postCode p ON p.townFk = t.id + AND (p.code = a.postalCode OR a.postalCode IS NULL) JOIN zoneGeo zg ON zg.id = p.geoFk WHERE a.id = vSelf ORDER BY (a.city SOUNDS LIKE t.name) DESC, diff --git a/db/routines/vn/functions/client_getGeo.sql b/db/routines/vn/functions/client_getGeo.sql index e16653ee5..9c2e3212e 100644 --- a/db/routines/vn/functions/client_getGeo.sql +++ b/db/routines/vn/functions/client_getGeo.sql @@ -15,6 +15,7 @@ BEGIN FROM client c JOIN town t ON t.provinceFk = c.provinceFk JOIN postCode p ON p.townFk = t.id + AND (p.code = c.postcode OR c.postcode IS NULL) JOIN zoneGeo zg ON zg.id = p.geoFk WHERE c.id = vSelf ORDER BY (c.city SOUNDS LIKE t.name) DESC, diff --git a/db/routines/vn/functions/supplier_getGeo.sql b/db/routines/vn/functions/supplier_getGeo.sql index 10ca5b8b8..86984272c 100644 --- a/db/routines/vn/functions/supplier_getGeo.sql +++ b/db/routines/vn/functions/supplier_getGeo.sql @@ -15,6 +15,7 @@ BEGIN FROM supplier s JOIN town t ON t.provinceFk = s.provinceFk JOIN postCode p ON p.townFk = t.id + AND (p.code = s.postCode OR s.postCode IS NULL) LEFT JOIN supplierAddress sad ON sad.supplierFk = s.id JOIN zoneGeo zg ON zg.id = p.geoFk WHERE s.id = vSelf diff --git a/db/routines/vn/procedures/itemShelvingSale_setQuantity.sql b/db/routines/vn/procedures/itemShelvingSale_setQuantity.sql index cde1b6872..f141762b5 100644 --- a/db/routines/vn/procedures/itemShelvingSale_setQuantity.sql +++ b/db/routines/vn/procedures/itemShelvingSale_setQuantity.sql @@ -3,7 +3,8 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelvingSale_setQ vItemShelvingSaleFk INT(10), vQuantity DECIMAL(10,0), vIsItemShelvingSaleEmpty BOOLEAN, - vSectorFk INT + vSectorFk INT, + vShelvingFk VARCHAR(10) ) BEGIN /** @@ -24,6 +25,7 @@ BEGIN DECLARE vItemFk INT; DECLARE vTotalQuantity INT; DECLARE vStateCode VARCHAR(45); + DECLARE vCurrentShelvingFk VARCHAR(10); DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN @@ -45,18 +47,25 @@ BEGIN iss.saleFk, iss.itemShelvingFk, SUM(IFNULL(iss.quantity,0)), - IF(sgd.id, 'PREVIOUS_PREPARATION', 'PREPARED') + IF(sgd.id, 'PREVIOUS_PREPARATION', 'PREPARED'), + ish.shelvingFk INTO vItemFk, vSaleFk, vItemShelvingFk, vReservedQuantity, - vStateCode + vStateCode, + vCurrentShelvingFk FROM itemShelvingSale iss JOIN sale s ON s.id = iss.saleFk + JOIN itemShelving ish ON ish.id = iss.itemShelvingFk LEFT JOIN vn.saleGroupDetail sgd ON sgd.saleFk = iss.saleFk WHERE iss.id = vItemShelvingSaleFk AND NOT iss.isPicked; + IF NOT (vCurrentShelvingFk <=> vShelvingFk) THEN + CALL util.throw('The shelving can not be different from the shelving reserved'); + END IF; + IF vQuantity > vReservedQuantity OR (vQuantity < vReservedQuantity AND NOT vIsItemShelvingSaleEmpty) OR (vQuantity = vReservedQuantity AND vIsItemShelvingSaleEmpty) THEN diff --git a/db/routines/vn/procedures/stockBought_calculate.sql b/db/routines/vn/procedures/stockBought_calculate.sql index c3b5a0dc6..c248d0deb 100644 --- a/db/routines/vn/procedures/stockBought_calculate.sql +++ b/db/routines/vn/procedures/stockBought_calculate.sql @@ -80,7 +80,7 @@ proc: BEGIN UPDATE stockBought s JOIN tStockSold ts ON ts.workerFk = s.workerFk - SET s.bought = IF(s.bought < ts.sold, ROUND(s.bought - ts.sold, 1), 0) + SET s.bought = IF(s.bought < ABS(ts.sold), 0, ROUND(s.bought - ABS(ts.sold), 1)) WHERE s.dated = vDated; DROP TEMPORARY TABLE tCurrentData, tmp.item, tmp.buyUltimate, tStockSold; diff --git a/db/versions/11346-yellowPhormium/00-address.sql b/db/versions/11346-yellowPhormium/00-address.sql index 6837e0d86..f91d0ae9f 100644 --- a/db/versions/11346-yellowPhormium/00-address.sql +++ b/db/versions/11346-yellowPhormium/00-address.sql @@ -10,6 +10,7 @@ CREATE OR REPLACE TEMPORARY TABLE tmp.tAddressGeo FROM vn.address a JOIN vn.town t ON t.provinceFk = a.provinceFk JOIN vn.postCode p ON p.townFk = t.id + AND (p.code = a.postalCode OR a.postalCode IS NULL) JOIN vn.zoneGeo zg ON zg.id = p.geoFk GROUP BY a.id ORDER BY (a.city SOUNDS LIKE t.`name`) DESC, diff --git a/db/versions/11346-yellowPhormium/01-client.sql b/db/versions/11346-yellowPhormium/01-client.sql index a95d21efa..cb6fe41e8 100644 --- a/db/versions/11346-yellowPhormium/01-client.sql +++ b/db/versions/11346-yellowPhormium/01-client.sql @@ -13,6 +13,7 @@ CREATE OR REPLACE TEMPORARY TABLE tmp.tClientGeo FROM vn.client c JOIN vn.town t ON t.provinceFk = c.provinceFk JOIN vn.postCode p ON p.townFk = t.id + AND (p.code = c.postcode OR c.postcode IS NULL) JOIN vn.zoneGeo zg ON zg.id = p.geoFk GROUP BY c.id ORDER BY (c.city SOUNDS LIKE t.`name`) DESC, diff --git a/db/versions/11346-yellowPhormium/02-supplier.sql b/db/versions/11346-yellowPhormium/02-supplier.sql index a28e7d680..4e866525e 100644 --- a/db/versions/11346-yellowPhormium/02-supplier.sql +++ b/db/versions/11346-yellowPhormium/02-supplier.sql @@ -12,6 +12,7 @@ CREATE OR REPLACE TEMPORARY TABLE tmp.tSupplierGeo FROM vn.supplier s JOIN vn.town t ON t.provinceFk = s.provinceFk JOIN vn.postCode p ON p.townFk = t.id + AND (p.code = s.postCode OR s.postCode IS NULL) LEFT JOIN vn.supplierAddress sad ON sad.supplierFk = s.id JOIN vn.zoneGeo zg ON zg.id = p.geoFk GROUP BY s.id diff --git a/db/versions/11353-wheatCymbidium/00-firstScript.sql b/db/versions/11353-wheatCymbidium/00-firstScript.sql new file mode 100644 index 000000000..557ffab9e --- /dev/null +++ b/db/versions/11353-wheatCymbidium/00-firstScript.sql @@ -0,0 +1,15 @@ + + +USE vn; + +INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId) +VALUES('RouteAction', 'find', 'READ', 'ALLOW', 'ROLE', 'delivery'); + +INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId) +VALUES('RouteComplement', 'find', 'READ', 'ALLOW', 'ROLE', 'delivery'); + +INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId) +VALUES('RouteComplement', 'create', 'WRITE', 'ALLOW', 'ROLE', 'delivery'); + +INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId) +VALUES('RouteComplement', 'deleteById', 'WRITE', 'ALLOW', 'ROLE', 'delivery'); \ No newline at end of file diff --git a/modules/entry/back/methods/stock-bought/getStockBoughtDetail.js b/modules/entry/back/methods/stock-bought/getStockBoughtDetail.js index 60b099682..723e04cb9 100644 --- a/modules/entry/back/methods/stock-bought/getStockBoughtDetail.js +++ b/modules/entry/back/methods/stock-bought/getStockBoughtDetail.js @@ -50,8 +50,11 @@ module.exports = Self => { i.id itemFk, i.name itemName, ti.quantity, - ROUND((ac.conversionCoefficient * (ti.quantity / b.packing) * buy_getVolume(b.id)) - / (vc.trolleyM3 * 1000000),1) volume, + ROUND((ac.conversionCoefficient * + (ti.quantity / b.packing) * + buy_getVolume(b.id) + ) / (vc.trolleyM3 * 1000000), + 2) volume, b.packagingFk packagingFk, b.packing FROM tmp.item ti diff --git a/modules/invoiceOut/front/index.js b/modules/invoiceOut/front/index.js index a5e51d439..6d58a0a45 100644 --- a/modules/invoiceOut/front/index.js +++ b/modules/invoiceOut/front/index.js @@ -1,7 +1,7 @@ export * from './module'; import './main'; -import './summary'; import './descriptor'; import './descriptor-popover'; import './descriptor-menu'; +import './summary'; diff --git a/modules/invoiceOut/front/routes.json b/modules/invoiceOut/front/routes.json index 7c7495cb9..908df3972 100644 --- a/modules/invoiceOut/front/routes.json +++ b/modules/invoiceOut/front/routes.json @@ -34,6 +34,12 @@ "params": { "invoice-out": "$ctrl.invoiceOut" } + }, + { + "url": "/:id", + "state": "invoiceOut.card", + "abstract": true, + "component": "vn-invoice-out-card" } ] } diff --git a/modules/order/back/methods/order/filter.js b/modules/order/back/methods/order/filter.js index f8df6e10e..ccc149958 100644 --- a/modules/order/back/methods/order/filter.js +++ b/modules/order/back/methods/order/filter.js @@ -22,7 +22,7 @@ module.exports = Self => { }, { arg: 'from', type: 'date', - description: 'The from date' + description: 'The from date', }, { arg: 'to', type: 'date', @@ -84,7 +84,6 @@ module.exports = Self => { Object.assign(myOptions, options); const args = ctx.args; - // Apply filter by team const teamMembersId = []; if (args.myTeam != null) { @@ -101,9 +100,12 @@ module.exports = Self => { teamMembersId.push(userId); } - if (args && args.myTeam) + if (args?.myTeam) args.teamIds = teamIds; + if (args?.to) + args.to.setHours(23, 59, 0, 0); + const where = buildFilter(args, (param, value) => { switch (param) { case 'search': @@ -151,7 +153,12 @@ module.exports = Self => { CREATE OR REPLACE TEMPORARY TABLE tmp.filter (INDEX (id)) ENGINE = MEMORY - SELECT o.id, + WITH wOrderTicket AS( + SELECT orderFk, + ticketFk + FROM orderTicket + GROUP BY orderFk + )SELECT o.id, o.total, o.date_send landed, o.date_make created, @@ -199,7 +206,6 @@ module.exports = Self => { `); stmt.merge(conn.makeWhere(filter.where)); - stmt.merge(`GROUP BY id`); stmt.merge(conn.makePagination(filter)); stmts.push(stmt); stmts.push(`SET SESSION optimizer_search_depth = @_optimizer_search_depth`); @@ -212,7 +218,6 @@ module.exports = Self => { const sql = ParameterizedSQL.join(stmts, ';'); const result = await conn.executeStmt(sql, myOptions); - return result[ordersIndex]; }; }; diff --git a/modules/route/back/model-config.json b/modules/route/back/model-config.json index be5aa07ca..fb1c5d7fd 100644 --- a/modules/route/back/model-config.json +++ b/modules/route/back/model-config.json @@ -23,6 +23,12 @@ "Route": { "dataSource": "vn" }, + "RouteAction": { + "dataSource": "vn" + }, + "RouteComplement": { + "dataSource": "vn" + }, "RouteLog": { "dataSource": "vn" }, @@ -32,4 +38,4 @@ "RoutesMonitor": { "dataSource": "vn" } -} +} \ No newline at end of file diff --git a/modules/route/back/models/routeAction.json b/modules/route/back/models/routeAction.json new file mode 100644 index 000000000..88f7a8226 --- /dev/null +++ b/modules/route/back/models/routeAction.json @@ -0,0 +1,30 @@ +{ + "name": "RouteAction", + "base": "VnModel", + "mixins": { + "Loggable": true + }, + "options": { + "mysql": { + "table": "routeAction" + } + }, + "properties": { + "id": { + "type": "number", + "id": true, + "description": "Identifier" + }, + "name": { + "type": "string", + "required": true + }, + "price": { + "type": "number" + }, + "isMainlineDelivered": { + "type": "boolean", + "required": true + } + } +} \ No newline at end of file diff --git a/modules/route/back/models/routeComplement.json b/modules/route/back/models/routeComplement.json new file mode 100644 index 000000000..e2086f78d --- /dev/null +++ b/modules/route/back/models/routeComplement.json @@ -0,0 +1,37 @@ +{ + "name": "RouteComplement", + "base": "VnModel", + "mixins": { + "Loggable": true + }, + "options": { + "mysql": { + "table": "routeComplement" + } + }, + "properties": { + "id": { + "type": "number", + "id": true, + "description": "Identifier" + }, + "dated": { + "type": "date" + }, + "price": { + "type": "number" + } + }, + "relations": { + "worker": { + "type": "belongsTo", + "model": "Worker", + "foreignKey": "workerFk" + }, + "routeAction": { + "type": "belongsTo", + "model": "RouteAction", + "foreignKey": "routeActionFk" + } + } +} \ No newline at end of file diff --git a/modules/ticket/back/methods/ticket/getSales.js b/modules/ticket/back/methods/ticket/getSales.js index e721d90ae..5b2288d31 100644 --- a/modules/ticket/back/methods/ticket/getSales.js +++ b/modules/ticket/back/methods/ticket/getSales.js @@ -37,6 +37,7 @@ module.exports = Self => { 'name', 'subName', 'itemPackingTypeFk', + 'size', 'tag5', 'value5', 'tag6', diff --git a/package.json b/package.json index 767ec231e..ef1dd8f89 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "salix-back", - "version": "24.44.0", + "version": "24.50.0", "author": "Verdnatura Levante SL", "description": "Salix backend", "license": "GPL-3.0",