From ab3ead6a28e01f6f1f91f13d2862fe65e39f35ab Mon Sep 17 00:00:00 2001 From: Bernat Exposito Date: Wed, 14 Mar 2018 13:00:17 +0100 Subject: [PATCH] added modelconfig.json for models in the commit 60f3bfc and new procedure 04.ticketVolume --- services/db/changes/1.0.2/04.ticketVolume.sql | 30 +++++++++++++++++++ services/ticket/server/model-config.json | 6 ++++ 2 files changed, 36 insertions(+) create mode 100644 services/db/changes/1.0.2/04.ticketVolume.sql diff --git a/services/db/changes/1.0.2/04.ticketVolume.sql b/services/db/changes/1.0.2/04.ticketVolume.sql new file mode 100644 index 000000000..5b6860700 --- /dev/null +++ b/services/db/changes/1.0.2/04.ticketVolume.sql @@ -0,0 +1,30 @@ +USE `vn`; +DROP procedure IF EXISTS `ticketVolume`; + +DELIMITER $$ +USE `vn`$$ +CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`ticketVolume`(IN vTicketId INT) +BEGIN + DECLARE vWarehouseId INTEGER; + DECLARE vShippedDate DATE; + + DROP TEMPORARY TABLE IF EXISTS ticketVolume; + SELECT warehouseFk, shipped INTO vWarehouseId,vShippedDate FROM vn.ticket WHERE id = vTicketId; + + CREATE TEMPORARY TABLE IF NOT EXISTS ticketVolume ENGINE MEMORY + + SELECT itemFk,quantity, concept, VolUd as m3_uni, volume as m3, @m3:= @m3 + ifnull(volume,0) as m3_total + FROM + ( + SELECT round(r.cm3 / 1000000,3) as VolUd ,s.quantity, round(r.cm3 * s.quantity / 1000000,3) as volume, + s.itemFk, s.concept, @m3:= 0, @vol:=0, t.agencyModeFk + FROM sale s + JOIN vn.ticket t on t.id = s.ticketFk + JOIN bi.rotacion r ON r.Id_Article = s.itemFk AND r.warehouse_id = t.warehouseFk + WHERE s.ticketFk = vTicketId + ) sub; + +END$$ + +DELIMITER ; + diff --git a/services/ticket/server/model-config.json b/services/ticket/server/model-config.json index 5b82e8f58..8a2b05c49 100644 --- a/services/ticket/server/model-config.json +++ b/services/ticket/server/model-config.json @@ -19,6 +19,12 @@ }, "SaleChecked": { "dataSource": "vn" + }, + "ComponentRate": { + "dataSource": "vn" + }, + "SaleComponent": { + "dataSource": "vn" } }