From e7be1e2efeb40c99ada9916deebfa915cf2b3c35 Mon Sep 17 00:00:00 2001 From: robert Date: Tue, 30 Apr 2024 11:48:18 +0200 Subject: [PATCH 01/17] feat: refs #7296 expeditionTruck to roadmapStop --- db/routines/dipole/procedures/expedition_add.sql | 4 ++-- .../srt/functions/expedition_getDayMinute.sql | 4 ++-- db/routines/srt/procedures/expedition_reset.sql | 4 ++-- db/routines/srt/views/bufferDayMinute.sql | 6 +++--- db/routines/srt/views/bufferStock.sql | 12 ++++++------ db/routines/srt/views/upperStickers.sql | 6 +++--- db/routines/vn/procedures/clean.sql | 2 +- .../vn/procedures/conveyorExpedition_Add.sql | 4 ++-- db/routines/vn/procedures/expeditionTruck_Add.sql | 2 +- .../vn/procedures/expeditionTruck_List.sql | 8 ++++---- db/routines/vn/procedures/expedition_StateGet.sql | 6 +++--- db/routines/vn/procedures/expedition_getState.sql | 6 +++--- .../vn/procedures/reportLabelCollection_get.sql | 4 ++-- .../vn/procedures/routeMonitor_calculate.sql | 4 ++-- db/routines/vn/views/expeditionCommon.sql | 12 ++++++------ db/routines/vn/views/expeditionPallet_Print.sql | 10 +++++----- db/routines/vn/views/expeditionRoute_Monitor.sql | 2 +- db/routines/vn/views/expeditionScan_Monitor.sql | 10 +++++----- db/routines/vn/views/expeditionSticker.sql | 4 ++-- db/routines/vn/views/expeditionTicket_NoBoxes.sql | 6 +++--- .../expeditionTruck_Control_Detail_Pallet.sql | 4 ++-- db/routines/vn/views/routesControl.sql | 8 ++++---- .../11022-crimsonArborvitae/00-firstScript.sql | 15 +++++++++++++++ .../reports/collection-label/sql/labelsData.sql | 4 ++-- .../expedition-pallet-label/sql/labelData.sql | 10 +++++----- 25 files changed, 86 insertions(+), 71 deletions(-) create mode 100644 db/versions/11022-crimsonArborvitae/00-firstScript.sql diff --git a/db/routines/dipole/procedures/expedition_add.sql b/db/routines/dipole/procedures/expedition_add.sql index a88c4d25a..e224cd2d2 100644 --- a/db/routines/dipole/procedures/expedition_add.sql +++ b/db/routines/dipole/procedures/expedition_add.sql @@ -34,7 +34,7 @@ BEGIN vPrinterFk, IFNULL(right(`t`.`routeFk`, 3),0), if (@vVolume := vn.ticketTotalVolume(t.id) > 1.5, @vVolume, IFNULL( rm.beachFk, 0)), - LEFT(IFNULL(et.description ,replace(`z`.`name`, 'ZONA ', 'Z')),14) truckName, + LEFT(IFNULL(rs.description ,replace(`z`.`name`, 'ZONA ', 'Z')),14) truckName, t.clientFk , ifnull(c.mobile, ifnull(a.mobile, ifnull(c.phone, a.phone))), LEFT(p.name, 20), @@ -46,7 +46,7 @@ BEGIN JOIN vn.address a ON a.id = t.addressFk JOIN vn.province p ON p.id = a.provinceFk LEFT JOIN vn.routesMonitor rm ON rm.routeFk = t.routeFk - LEFT JOIN vn.expeditionTruck et ON et.id = rm.expeditionTruckFk + LEFT JOIN vn.roadmapStop rs ON rs.id = rm.expeditionTruckFk LEFT JOIN vn.beach b ON b.code = rm.beachFk LEFT JOIN vn.`zone`z ON z.id = t.zoneFk JOIN vn.agencyMode am ON t.agencyModeFk = am.id diff --git a/db/routines/srt/functions/expedition_getDayMinute.sql b/db/routines/srt/functions/expedition_getDayMinute.sql index 7a8fae686..9331f77e5 100644 --- a/db/routines/srt/functions/expedition_getDayMinute.sql +++ b/db/routines/srt/functions/expedition_getDayMinute.sql @@ -15,14 +15,14 @@ BEGIN DECLARE vDayMinute INT; - SELECT HOUR(IFNULL(et.ETD, z.`hour`)) * 60 + MINUTE(IFNULL(et.ETD, z.`hour`)) INTO vDayMinute + SELECT HOUR(IFNULL(rs.ETD, z.`hour`)) * 60 + MINUTE(IFNULL(rs.ETD, z.`hour`)) INTO vDayMinute FROM vn.expedition e JOIN vn.ticket t ON e.ticketFk = t.id JOIN vn.`zone` z ON z.id = t.zoneFk LEFT JOIN vn.route r ON r.id = t.routeFk LEFT JOIN vn.agencyMode am ON am.id = r.agencyModeFk LEFT JOIN vn.routesMonitor rm ON t.routeFk = rm.routeFk - LEFT JOIN vn.expeditionTruck et ON rm.expeditionTruckFk = et.id + LEFT JOIN vn.roadmapStop rs ON rm.expeditionTruckFk = rs.id WHERE e.id = vExpeditionFk; RETURN vDayMinute; diff --git a/db/routines/srt/procedures/expedition_reset.sql b/db/routines/srt/procedures/expedition_reset.sql index 712c93e18..153edfad2 100644 --- a/db/routines/srt/procedures/expedition_reset.sql +++ b/db/routines/srt/procedures/expedition_reset.sql @@ -296,8 +296,8 @@ BEGIN SET @dm := (24 * 60) - 10; - UPDATE vn.expeditionTruck et - SET et.eta = timestampadd(MINUTE ,@dm := 1 + @dm,util.VN_CURDATE()) + UPDATE vn.roadmapStop rs + SET rs.eta = timestampadd(MINUTE ,@dm := 1 + @dm,util.VN_CURDATE()) WHERE description LIKE 'PRU%' ; DELETE FROM srt.movingLog ; diff --git a/db/routines/srt/views/bufferDayMinute.sql b/db/routines/srt/views/bufferDayMinute.sql index 8ee732c56..41db2bcf7 100644 --- a/db/routines/srt/views/bufferDayMinute.sql +++ b/db/routines/srt/views/bufferDayMinute.sql @@ -3,10 +3,10 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` VIEW `srt`.`bufferDayMinute` AS SELECT `b`.`id` AS `bufferFk`, `e`.`id` AS `expeditionFk`, - `srt`.`dayMinute`(IFNULL(`et`.`eta`, `z`.`hour`)) AS `dayMinute`, + `srt`.`dayMinute`(IFNULL(`rs`.`eta`, `z`.`hour`)) AS `dayMinute`, `e`.`position` AS `position`, IFNULL( - `et`.`eta`, + `rs`.`eta`, `util`.`VN_CURDATE`() + INTERVAL `srt`.`dayMinute`(`z`.`hour`) MINUTE ) AS `ETD`, `e2`.`ticketFk` AS `ticketFk`, @@ -34,7 +34,7 @@ FROM ( ) LEFT JOIN `vn`.`routesMonitor` `rm` ON(`t`.`routeFk` = `rm`.`routeFk`) ) - LEFT JOIN `vn`.`expeditionTruck` `et` ON(`rm`.`expeditionTruckFk` = `et`.`id`) + LEFT JOIN `vn`.`roadmapStop` `rs` ON(`rm`.`expeditionTruckFk` = `rs`.`id`) ) LEFT JOIN `vn`.`zone` `z` ON(`z`.`id` = `t`.`zoneFk`) ) diff --git a/db/routines/srt/views/bufferStock.sql b/db/routines/srt/views/bufferStock.sql index 6f9d7e2fe..7494cf0a9 100644 --- a/db/routines/srt/views/bufferStock.sql +++ b/db/routines/srt/views/bufferStock.sql @@ -4,22 +4,22 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` AS SELECT `e`.`id` AS `expeditionFk`, `e`.`bufferFk` AS `bufferFk`, `e`.`position` AS `position`, - `srt`.`dayMinute`(IFNULL(`et`.`eta`, `z`.`hour`)) AS `dayMinute`, + `srt`.`dayMinute`(IFNULL(`rs`.`eta`, `z`.`hour`)) AS `dayMinute`, IFNULL( - `et`.`eta`, + `rs`.`eta`, `util`.`VN_CURDATE`() + INTERVAL `srt`.`dayMinute`(`z`.`hour`) + 120 MINUTE ) AS `eta`, `ve`.`ticketFk` AS `ticketFk`, IFNULL(`t`.`routeFk`, `t`.`agencyModeFk`) AS `routeFk`, `z`.`name` AS `zonaTicket`, - `et`.`description` AS `truck`, + `rs`.`description` AS `truck`, `es`.`description` AS `expeditionState`, `b`.`hasWorkerWaiting` AS `hasWorkerWaiting`, `b`.`isActive` AS `isActive`, IF( - `et`.`id` IS NULL, + `rs`.`id` IS NULL, `c`.`bufferDefault`, - `et`.`bufferFk` + `rs`.`bufferFk` ) AS `bufferTruck`, `bt`.`typeName` AS `typeName`, `rm`.`bufferFk` AS `routeBuffer` @@ -45,7 +45,7 @@ FROM ( ) LEFT JOIN `vn`.`routesMonitor` `rm` ON(`t`.`routeFk` = `rm`.`routeFk`) ) - LEFT JOIN `vn`.`expeditionTruck` `et` ON(`rm`.`expeditionTruckFk` = `et`.`id`) + LEFT JOIN `vn`.`roadmapStop` `rs` ON(`rm`.`expeditionTruckFk` = `rs`.`id`) ) JOIN `srt`.`config` `c` ) diff --git a/db/routines/srt/views/upperStickers.sql b/db/routines/srt/views/upperStickers.sql index d7e7b9898..a230408d9 100644 --- a/db/routines/srt/views/upperStickers.sql +++ b/db/routines/srt/views/upperStickers.sql @@ -4,13 +4,13 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` AS SELECT `e`.`id` AS `expeditionFk`, `e`.`id` MOD 10000 AS `expedition`, IFNULL( - `et`.`eta`, + `rs`.`eta`, `util`.`VN_CURDATE`() + INTERVAL `srt`.`dayMinute`(`z`.`hour`) + 120 MINUTE ) AS `ETD`, `ve`.`ticketFk` AS `ticketFk`, right(IFNULL(`t`.`routeFk`, `t`.`agencyModeFk`), 3) AS `routeFk`, `z`.`name` AS `zonaTicket`, - `et`.`description` AS `truck`, + `rs`.`description` AS `truck`, `epo`.`workerCode` AS `worker`, `p`.`name` AS `labeler`, `ve`.`counter` AS `expeditionCounter`, @@ -32,7 +32,7 @@ FROM ( ) LEFT JOIN `vn`.`routesMonitor` `rm` ON(`t`.`routeFk` = `rm`.`routeFk`) ) - LEFT JOIN `vn`.`expeditionTruck` `et` ON(`rm`.`expeditionTruckFk` = `et`.`id`) + LEFT JOIN `vn`.`roadmapStop` `rs` ON(`rm`.`expeditionTruckFk` = `rs`.`id`) ) JOIN `dipole`.`expedition_PrintOut` `epo` ON(`epo`.`expeditionFk` = `e`.`id`) ) diff --git a/db/routines/vn/procedures/clean.sql b/db/routines/vn/procedures/clean.sql index ed1569935..0fdcba886 100644 --- a/db/routines/vn/procedures/clean.sql +++ b/db/routines/vn/procedures/clean.sql @@ -86,7 +86,7 @@ BEGIN WHERE cs.description = 'Anulado' AND c.created < v2Months; - DELETE FROM expeditionTruck WHERE eta < v3Months; + DELETE FROM roadmapStop WHERE eta < v3Months; DELETE FROM XDiario WHERE FECHA < v3Months OR FECHA IS NULL; -- Borrar travels sin entradas diff --git a/db/routines/vn/procedures/conveyorExpedition_Add.sql b/db/routines/vn/procedures/conveyorExpedition_Add.sql index c57c2ea37..daaf33f2f 100644 --- a/db/routines/vn/procedures/conveyorExpedition_Add.sql +++ b/db/routines/vn/procedures/conveyorExpedition_Add.sql @@ -24,7 +24,7 @@ BEGIN 10 * p.height as height, IFNULL(t.routeFk,am.agencyFk) routeFk, hour(e.created) * 60 + minute(e.created), - IFNULL(et.description , a.name), + IFNULL(rs.description , a.name), IFNULL(t.routeFk,am.agencyFk) criterion, IFNULL(p.conveyorBuildingClassFk , pc.defaultConveyorBuildingClass) FROM vn.expedition e @@ -34,7 +34,7 @@ BEGIN LEFT JOIN vn.agencyMode am ON am.id = z.agencyModeFk LEFT JOIN vn.agency a ON a.id = am.agencyFk LEFT JOIN vn.routesMonitor rm ON rm.routeFk = t.routeFk - LEFT JOIN vn.expeditionTruck et ON et.id = rm.expeditionTruckFk + LEFT JOIN vn.roadmapStop rs ON rs.id = rm.expeditionTruckFk JOIN vn.packagingConfig pc WHERE t.warehouseFk IN (60,1,44) AND e.created BETWEEN vStarted AND vEnded diff --git a/db/routines/vn/procedures/expeditionTruck_Add.sql b/db/routines/vn/procedures/expeditionTruck_Add.sql index e4009ca47..eabfa452c 100644 --- a/db/routines/vn/procedures/expeditionTruck_Add.sql +++ b/db/routines/vn/procedures/expeditionTruck_Add.sql @@ -2,7 +2,7 @@ DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`expeditionTruck_Add`(vHour VARCHAR(5), vDescription VARCHAR(45)) BEGIN - INSERT INTO vn.expeditionTruck(eta,description) + INSERT INTO vn.roadmapStop(eta,description) VALUES(CONCAT(util.VN_CURDATE(), ' ', vHour), vDescription); END$$ diff --git a/db/routines/vn/procedures/expeditionTruck_List.sql b/db/routines/vn/procedures/expeditionTruck_List.sql index 2434f9274..c358df5e3 100644 --- a/db/routines/vn/procedures/expeditionTruck_List.sql +++ b/db/routines/vn/procedures/expeditionTruck_List.sql @@ -4,9 +4,9 @@ BEGIN SELECT id truckFk, eta, - description Destino - FROM expeditionTruck - WHERE eta BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE()) - ORDER BY eta; + description Destino + FROM roadmapStop + WHERE eta BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE()) + ORDER BY eta; END$$ DELIMITER ; diff --git a/db/routines/vn/procedures/expedition_StateGet.sql b/db/routines/vn/procedures/expedition_StateGet.sql index 17fcf91e5..e58ec3afd 100644 --- a/db/routines/vn/procedures/expedition_StateGet.sql +++ b/db/routines/vn/procedures/expedition_StateGet.sql @@ -53,8 +53,8 @@ BEGIN am.name zonaRuta, t.routeFk ruta, rm.beachFk ubicacion, - et.eta , - et.description camion, + rs.eta , + rs.description camion, vTicketsPendientes AS ticketsPendientes, vEtiquetasTotales AS etiquetasTotales, vEtiquetasEscaneadas AS etiquetasEscaneadas, @@ -67,7 +67,7 @@ BEGIN LEFT JOIN vn.route r ON r.id = t.routeFk LEFT JOIN vn.agencyMode am ON am.id = r.agencyModeFk LEFT JOIN vn.routesMonitor rm ON rm.routeFk = r.id - LEFT JOIN vn.expeditionTruck et ON et.id = rm.expeditionTruckFk + LEFT JOIN vn.roadmapStop rs ON rs.id = rm.expeditionTruckFk WHERE e.id = vExpeditionFk; END$$ diff --git a/db/routines/vn/procedures/expedition_getState.sql b/db/routines/vn/procedures/expedition_getState.sql index 96e247e4d..f3f94a889 100644 --- a/db/routines/vn/procedures/expedition_getState.sql +++ b/db/routines/vn/procedures/expedition_getState.sql @@ -37,8 +37,8 @@ BEGIN am.name zonaRuta, t.routeFk ruta, rm.beachFk ubicacion, - et.eta , - et.description camion, + rs.eta , + rs.description camion, vTicketsPendientes AS ticketsPendientes, vEtiquetasTotales AS etiquetasTotales, vEtiquetasEscaneadas AS etiquetasEscaneadas @@ -50,7 +50,7 @@ BEGIN LEFT JOIN vn.route r ON r.id = t.routeFk LEFT JOIN vn.agencyMode am ON am.id = r.agencyModeFk LEFT JOIN vn.routesMonitor rm ON rm.routeFk = r.id - LEFT JOIN vn.expeditionTruck et ON et.id = rm.expeditionTruckFk + LEFT JOIN vn.roadmapStop rs ON rs.id = rm.expeditionTruckFk WHERE e.id = vExpeditionFk; END$$ diff --git a/db/routines/vn/procedures/reportLabelCollection_get.sql b/db/routines/vn/procedures/reportLabelCollection_get.sql index 6ad5ae964..e7f8f2bc3 100644 --- a/db/routines/vn/procedures/reportLabelCollection_get.sql +++ b/db/routines/vn/procedures/reportLabelCollection_get.sql @@ -20,7 +20,7 @@ BEGIN CONCAT(tc.collectionFk, ' ', LEFT(cc.code, 4)) color, CONCAT(tc.collectionFk, ' ', SUBSTRING('ABCDEFGH',tc.wagon, 1), '-', tc.level) levelV, tc.ticketFk, - LEFT(COALESCE(et.description, zo.name, am.name),12) agencyDescription, + LEFT(COALESCE(rs.description, zo.name, am.name),12) agencyDescription, am.name, t.clientFk, CONCAT(CAST(SUM(sv.volume) AS DECIMAL(5, 2)), 'm³') m3 , @@ -47,7 +47,7 @@ BEGIN LEFT JOIN ticketTrolley tt ON tt.ticket = t.id LEFT JOIN zone zo ON t.zoneFk = zo.id LEFT JOIN routesMonitor rm ON rm.routeFk = t.routeFk - LEFT JOIN expeditionTruck et ON et.id = rm.expeditionTruckFk + LEFT JOIN roadmapStop rs ON rs.id = rm.expeditionTruckFk WHERE IF(vIsCollection, tc.collectionFk = vParam, tc.ticketFk = vParam) GROUP BY t.id ORDER BY cc.code; diff --git a/db/routines/vn/procedures/routeMonitor_calculate.sql b/db/routines/vn/procedures/routeMonitor_calculate.sql index af7f5297e..04a31a161 100644 --- a/db/routines/vn/procedures/routeMonitor_calculate.sql +++ b/db/routines/vn/procedures/routeMonitor_calculate.sql @@ -106,8 +106,8 @@ BEGIN SET rm.m3boxes = sub.m3boxes; UPDATE routesMonitor rm - JOIN vn.expeditionTruck et ON et.id = rm.expeditionTruckFk - SET rm.etd = et.eta; + JOIN vn.roadmapStop rs ON rs.id = rm.expeditionTruckFk + SET rm.etd = rs.eta; DROP TEMPORARY TABLE tmp.routesMonitor; END$$ diff --git a/db/routines/vn/views/expeditionCommon.sql b/db/routines/vn/views/expeditionCommon.sql index f03966c05..06f0b3c6d 100644 --- a/db/routines/vn/views/expeditionCommon.sql +++ b/db/routines/vn/views/expeditionCommon.sql @@ -1,9 +1,9 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vn`.`expeditionCommon` -AS SELECT `et`.`id` AS `truckFk`, - `et`.`eta` AS `eta`, - IFNULL(ucase(`et`.`description`), 'SIN ESCANEAR') AS `description`, +AS SELECT `rs`.`id` AS `truckFk`, + `rs`.`eta` AS `eta`, + IFNULL(ucase(`rs`.`description`), 'SIN ESCANEAR') AS `description`, `es`.`palletFk` AS `palletFk`, `t`.`routeFk` AS `routeFk`, `es`.`id` AS `scanFk`, @@ -17,8 +17,8 @@ FROM ( ( ( ( - `vn`.`expeditionTruck` `et` - LEFT JOIN `vn`.`routesMonitor` `r` ON(`et`.`id` = `r`.`expeditionTruckFk`) + `vn`.`roadmapStop` `et` + LEFT JOIN `vn`.`routesMonitor` `r` ON(`rs`.`id` = `r`.`expeditionTruckFk`) ) LEFT JOIN `vn`.`ticket` `t` ON(`r`.`routeFk` = `t`.`routeFk`) ) @@ -28,4 +28,4 @@ FROM ( ) LEFT JOIN `vn`.`expeditionPallet` `ep` ON(`es`.`palletFk` = `ep`.`id`) ) -WHERE `et`.`eta` >= `util`.`VN_CURDATE`() +WHERE `rs`.`eta` >= `util`.`VN_CURDATE`() diff --git a/db/routines/vn/views/expeditionPallet_Print.sql b/db/routines/vn/views/expeditionPallet_Print.sql index 07627e817..da3d41bf8 100644 --- a/db/routines/vn/views/expeditionPallet_Print.sql +++ b/db/routines/vn/views/expeditionPallet_Print.sql @@ -1,12 +1,12 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vn`.`expeditionPallet_Print` -AS SELECT `et2`.`description` AS `truck`, +AS SELECT `rs2`.`description` AS `truck`, `t`.`routeFk` AS `routeFk`, `r`.`description` AS `zone`, COUNT(`es`.`id`) AS `eti`, `ep`.`id` AS `palletFk`, - `et`.`id` <=> `rm`.`expeditionTruckFk` AS `isMatch`, + `rs`.`id` <=> `rm`.`expeditionTruckFk` AS `isMatch`, `t`.`warehouseFk` AS `warehouseFk`, IF( `r`.`created` > `util`.`VN_CURDATE`() + INTERVAL 1 DAY, @@ -20,8 +20,8 @@ FROM ( ( ( ( - `vn`.`expeditionTruck` `et` - JOIN `vn`.`expeditionPallet` `ep` ON(`ep`.`truckFk` = `et`.`id`) + `vn`.`roadmapStop` `et` + JOIN `vn`.`expeditionPallet` `ep` ON(`ep`.`truckFk` = `rs`.`id`) ) JOIN `vn`.`expeditionScan` `es` ON(`es`.`palletFk` = `ep`.`id`) ) @@ -33,7 +33,7 @@ FROM ( ) LEFT JOIN `vn`.`routesMonitor` `rm` ON(`rm`.`routeFk` = `r`.`id`) ) - LEFT JOIN `vn`.`expeditionTruck` `et2` ON(`et2`.`id` = `rm`.`expeditionTruckFk`) + LEFT JOIN `vn`.`roadmapStop` `rs2` ON(`rs2`.`id` = `rm`.`expeditionTruckFk`) ) GROUP BY `ep`.`id`, `t`.`routeFk` diff --git a/db/routines/vn/views/expeditionRoute_Monitor.sql b/db/routines/vn/views/expeditionRoute_Monitor.sql index 774f21433..cc1f16894 100644 --- a/db/routines/vn/views/expeditionRoute_Monitor.sql +++ b/db/routines/vn/views/expeditionRoute_Monitor.sql @@ -15,7 +15,7 @@ FROM ( `vn`.`route` `r` LEFT JOIN `vn`.`routesMonitor` `rm` ON(`r`.`id` = `rm`.`routeFk`) ) - LEFT JOIN `vn`.`expeditionTruck` `et` ON(`et`.`id` = `rm`.`expeditionTruckFk`) + LEFT JOIN `vn`.`roadmapStop` `rs` ON(`rs`.`id` = `rm`.`expeditionTruckFk`) ) JOIN `vn`.`ticket` `t` ON(`t`.`routeFk` = `r`.`id`) ) diff --git a/db/routines/vn/views/expeditionScan_Monitor.sql b/db/routines/vn/views/expeditionScan_Monitor.sql index 7566a0bfd..b73107b68 100644 --- a/db/routines/vn/views/expeditionScan_Monitor.sql +++ b/db/routines/vn/views/expeditionScan_Monitor.sql @@ -1,9 +1,9 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vn`.`expeditionScan_Monitor` -AS SELECT `et`.`id` AS `truckFk`, - `et`.`eta` AS `ETD`, - `et`.`description` AS `description`, +AS SELECT `rs`.`id` AS `truckFk`, + `rs`.`eta` AS `ETD`, + `rs`.`description` AS `description`, `ep`.`id` AS `palletFk`, `ep`.`position` AS `position`, `ep`.`built` AS `built`, @@ -12,8 +12,8 @@ AS SELECT `et`.`id` AS `truckFk`, `es`.`scanned` AS `scanned` FROM ( ( - `vn`.`expeditionTruck` `et` - LEFT JOIN `vn`.`expeditionPallet` `ep` ON(`ep`.`truckFk` = `et`.`id`) + `vn`.`roadmapStop` `et` + LEFT JOIN `vn`.`expeditionPallet` `ep` ON(`ep`.`truckFk` = `rs`.`id`) ) LEFT JOIN `vn`.`expeditionScan` `es` ON(`es`.`palletFk` = `ep`.`id`) ) diff --git a/db/routines/vn/views/expeditionSticker.sql b/db/routines/vn/views/expeditionSticker.sql index 2b6bf18d2..05fbc42a1 100644 --- a/db/routines/vn/views/expeditionSticker.sql +++ b/db/routines/vn/views/expeditionSticker.sql @@ -14,7 +14,7 @@ AS SELECT `e`.`id` AS `expeditionFk`, IF( `t`.`routeFk`, IFNULL( - `et`.`description`, + `rs`.`description`, REPLACE(`am`.`name`, 'ZONA ', 'Z') ), `z`.`name` @@ -45,7 +45,7 @@ FROM ( ) LEFT JOIN `vn`.`routesMonitor` `rm` ON(`rm`.`routeFk` = `t`.`routeFk`) ) - LEFT JOIN `vn`.`expeditionTruck` `et` ON(`et`.`id` = `rm`.`expeditionTruckFk`) + LEFT JOIN `vn`.`roadmapStop` `rs` ON(`rs`.`id` = `rm`.`expeditionTruckFk`) ) LEFT JOIN `vn`.`beach` `b` ON(`b`.`code` = `rm`.`beachFk`) ) diff --git a/db/routines/vn/views/expeditionTicket_NoBoxes.sql b/db/routines/vn/views/expeditionTicket_NoBoxes.sql index 080edd3ac..8acbe17fe 100644 --- a/db/routines/vn/views/expeditionTicket_NoBoxes.sql +++ b/db/routines/vn/views/expeditionTicket_NoBoxes.sql @@ -4,7 +4,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` AS SELECT `t`.`id` AS `ticketFk`, `t`.`warehouseFk` AS `warehouseFk`, `t`.`routeFk` AS `routeFk`, - `et`.`description` AS `description` + `rs`.`description` AS `description` FROM ( ( ( @@ -13,7 +13,7 @@ FROM ( ) JOIN `vn`.`routesMonitor` `rm` ON(`rm`.`routeFk` = `t`.`routeFk`) ) - JOIN `vn`.`expeditionTruck` `et` ON(`et`.`id` = `rm`.`expeditionTruckFk`) + JOIN `vn`.`roadmapStop` `rs` ON(`rs`.`id` = `rm`.`expeditionTruckFk`) ) WHERE `e`.`id` IS NULL - AND `et`.`eta` > `util`.`VN_CURDATE`() + AND `rs`.`eta` > `util`.`VN_CURDATE`() diff --git a/db/routines/vn/views/expeditionTruck_Control_Detail_Pallet.sql b/db/routines/vn/views/expeditionTruck_Control_Detail_Pallet.sql index 01bdbf795..3f239432d 100644 --- a/db/routines/vn/views/expeditionTruck_Control_Detail_Pallet.sql +++ b/db/routines/vn/views/expeditionTruck_Control_Detail_Pallet.sql @@ -7,13 +7,13 @@ AS SELECT `e`.`truckFk` AS `id`, `e`.`palletFk` AS `pallet`, `e`.`routeFk` AS `route`, COUNT(DISTINCT `e`.`scanFk`) AS `scans`, - `et`.`description` AS `destinos`, + `rs`.`description` AS `destinos`, sum(`e`.`truckFk` <> `e`.`expeditionTruckFk`) AS `fallos`, `e`.`expeditionTruckFk` AS `expeditionTruckFk`, max(`e`.`lastPacked`) AS `lastPacked` FROM ( `vn`.`expeditionCommon` `e` - LEFT JOIN `vn`.`expeditionTruck` `et` ON(`et`.`id` = `e`.`expeditionTruckFk`) + LEFT JOIN `vn`.`roadmapStop` `rs` ON(`rs`.`id` = `e`.`expeditionTruckFk`) ) GROUP BY `e`.`truckFk`, `e`.`palletFk`, diff --git a/db/routines/vn/views/routesControl.sql b/db/routines/vn/views/routesControl.sql index 380d9d9ce..282dd21e3 100644 --- a/db/routines/vn/views/routesControl.sql +++ b/db/routines/vn/views/routesControl.sql @@ -6,8 +6,8 @@ AS SELECT `t`.`routeFk` AS `routeFk`, COUNT(`es`.`id`) AS `scanned`, COUNT(DISTINCT `es`.`palletFk`) AS `pallets`, max(`es`.`scanned`) AS `lastScanned`, - max(`et`.`description`) AS `description`, - max(`et`.`eta`) AS `eta` + max(`rs`.`description`) AS `description`, + max(`rs`.`eta`) AS `eta` FROM ( ( ( @@ -19,9 +19,9 @@ FROM ( ) LEFT JOIN `vn`.`expeditionPallet` `ep` ON(`ep`.`id` = `es`.`palletFk`) ) - LEFT JOIN `vn`.`expeditionTruck` `et` ON(`et`.`id` = `ep`.`truckFk`) + LEFT JOIN `vn`.`roadmapStop` `rs` ON(`rs`.`id` = `ep`.`truckFk`) ) WHERE `t`.`shipped` >= `util`.`VN_CURDATE`() AND `t`.`routeFk` <> 0 GROUP BY `t`.`routeFk` -ORDER BY max(`et`.`eta`) +ORDER BY max(`rs`.`eta`) diff --git a/db/versions/11022-crimsonArborvitae/00-firstScript.sql b/db/versions/11022-crimsonArborvitae/00-firstScript.sql new file mode 100644 index 000000000..608ae67fb --- /dev/null +++ b/db/versions/11022-crimsonArborvitae/00-firstScript.sql @@ -0,0 +1,15 @@ +-- Place your SQL code here +ALTER TABLE IF EXISTS vn.expeditionTruck RENAME vn.roadmapStop; + +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn`.`expeditionTruck` +AS SELECT `rs`.`id` AS `id`, + `rs`.`roadmapFk` AS `roadmapFk`, + `rs`.`warehouseFk` AS `warehouseFk`, + `rs`.`eta` AS `eta`, + `rs`.`description` AS `description`, + `rs`.`bufferFk` AS `bufferFk`, + `rs`.`created` AS `created`, + `rs`.`userFk` AS `userFk` +FROM `vn`.`roadmapStop` `rs`; \ No newline at end of file diff --git a/print/templates/reports/collection-label/sql/labelsData.sql b/print/templates/reports/collection-label/sql/labelsData.sql index 61990812d..b2661f8a9 100644 --- a/print/templates/reports/collection-label/sql/labelsData.sql +++ b/print/templates/reports/collection-label/sql/labelsData.sql @@ -3,7 +3,7 @@ SELECT c.itemPackingTypeFk code, SUBSTRING('ABCDEFGH', tc.wagon, 1) wagon, tc.`level`, t.id ticketFk, - COALESCE(et.description, zo.name, am.name) agencyDescription, + COALESCE(rs.description, zo.name, am.name) agencyDescription, cc.code color, t.clientFk, CAST(SUM(sv.volume) AS DECIMAL(5, 2)) volume, @@ -34,7 +34,7 @@ SELECT c.itemPackingTypeFk code, LEFT JOIN vn.ticketTrolley tt ON tt.ticket = t.id LEFT JOIN vn.`zone` zo ON t.zoneFk = zo.id LEFT JOIN vn.routesMonitor rm ON rm.routeFk = t.routeFk - LEFT JOIN vn.expeditionTruck et ON et.id = rm.expeditionTruckFk + LEFT JOIN vn.roadmapStop rs ON rs.id = rm.expeditionTruckFk LEFT JOIN vn.saleGroupDetail sgd ON sgd.saleFk = s.id JOIN vn.productionConfig pc WHERE t.id IN (?) diff --git a/print/templates/reports/expedition-pallet-label/sql/labelData.sql b/print/templates/reports/expedition-pallet-label/sql/labelData.sql index b2a805251..385614305 100644 --- a/print/templates/reports/expedition-pallet-label/sql/labelData.sql +++ b/print/templates/reports/expedition-pallet-label/sql/labelData.sql @@ -1,19 +1,19 @@ SELECT ep.id palletFk, t.routeFk, - et2.description truck, + rs2.description truck, r.description `zone`, COUNT(es.id) labels, t.warehouseFk warehouseFk, dayname(r.created) `dayName`, - et.id <=> rm.expeditionTruckFk isMatch - FROM vn.expeditionTruck et - JOIN vn.expeditionPallet ep ON ep.truckFk = et.id + rs.id <=> rm.expeditionTruckFk isMatch + FROM vn.roadmapStop rs + JOIN vn.expeditionPallet ep ON ep.truckFk = rs.id JOIN vn.expeditionScan es ON es.palletFk = ep.id JOIN vn.expedition e ON e.id = es.expeditionFk JOIN vn.ticket t ON t.id = e.ticketFk JOIN vn.route r ON r.id = t.routeFk LEFT JOIN vn.routesMonitor rm ON rm.routeFk = r.id - LEFT JOIN vn.expeditionTruck et2 ON et2.id = rm.expeditionTruckFk + LEFT JOIN vn.roadmapStop rs2 ON rs2.id = rm.expeditionTruckFk WHERE ep.id = ? GROUP BY ep.id, t.routeFk ORDER BY t.routeFk From 83e9756692021718bde0351b0e3cb4d91f07cda2 Mon Sep 17 00:00:00 2001 From: robert Date: Tue, 30 Apr 2024 12:02:19 +0200 Subject: [PATCH 02/17] fear: refs #7296 expeditionTruck --- db/routines/vn/views/expeditionCommon.sql | 2 +- db/routines/vn/views/expeditionPallet_Print.sql | 2 +- db/routines/vn/views/expeditionScan_Monitor.sql | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/db/routines/vn/views/expeditionCommon.sql b/db/routines/vn/views/expeditionCommon.sql index 06f0b3c6d..d1ce80880 100644 --- a/db/routines/vn/views/expeditionCommon.sql +++ b/db/routines/vn/views/expeditionCommon.sql @@ -17,7 +17,7 @@ FROM ( ( ( ( - `vn`.`roadmapStop` `et` + `vn`.`roadmapStop` `rs` LEFT JOIN `vn`.`routesMonitor` `r` ON(`rs`.`id` = `r`.`expeditionTruckFk`) ) LEFT JOIN `vn`.`ticket` `t` ON(`r`.`routeFk` = `t`.`routeFk`) diff --git a/db/routines/vn/views/expeditionPallet_Print.sql b/db/routines/vn/views/expeditionPallet_Print.sql index da3d41bf8..c0b8208c3 100644 --- a/db/routines/vn/views/expeditionPallet_Print.sql +++ b/db/routines/vn/views/expeditionPallet_Print.sql @@ -20,7 +20,7 @@ FROM ( ( ( ( - `vn`.`roadmapStop` `et` + `vn`.`roadmapStop` `rs` JOIN `vn`.`expeditionPallet` `ep` ON(`ep`.`truckFk` = `rs`.`id`) ) JOIN `vn`.`expeditionScan` `es` ON(`es`.`palletFk` = `ep`.`id`) diff --git a/db/routines/vn/views/expeditionScan_Monitor.sql b/db/routines/vn/views/expeditionScan_Monitor.sql index b73107b68..94bda1863 100644 --- a/db/routines/vn/views/expeditionScan_Monitor.sql +++ b/db/routines/vn/views/expeditionScan_Monitor.sql @@ -12,7 +12,7 @@ AS SELECT `rs`.`id` AS `truckFk`, `es`.`scanned` AS `scanned` FROM ( ( - `vn`.`roadmapStop` `et` + `vn`.`roadmapStop` `rs` LEFT JOIN `vn`.`expeditionPallet` `ep` ON(`ep`.`truckFk` = `rs`.`id`) ) LEFT JOIN `vn`.`expeditionScan` `es` ON(`es`.`palletFk` = `ep`.`id`) From 1a375c0e883b53b979c6a7feca19e14111f565c6 Mon Sep 17 00:00:00 2001 From: guillermo Date: Wed, 8 May 2024 14:45:37 +0200 Subject: [PATCH 03/17] refactor: refs #7252 Deprecated vn.deliveryNote.farmingFk --- db/routines/vn/views/exchangeReportSource.sql | 22 -------------- .../vn/views/exchangeReportSourcePrevious.sql | 29 ------------------- db/routines/vn2008/views/albaran.sql | 3 +- .../11038-yellowFern/00-firstScript.sql | 1 + 4 files changed, 2 insertions(+), 53 deletions(-) delete mode 100644 db/routines/vn/views/exchangeReportSource.sql delete mode 100644 db/routines/vn/views/exchangeReportSourcePrevious.sql create mode 100644 db/versions/11038-yellowFern/00-firstScript.sql diff --git a/db/routines/vn/views/exchangeReportSource.sql b/db/routines/vn/views/exchangeReportSource.sql deleted file mode 100644 index 6a2b9bb7e..000000000 --- a/db/routines/vn/views/exchangeReportSource.sql +++ /dev/null @@ -1,22 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn`.`exchangeReportSource` -AS SELECT `e`.`dated` AS `dated`, - cast(sum(`e`.`amountIn`) AS decimal(10, 2)) AS `amountIn`, - cast(sum(`e`.`rateIn`) AS decimal(10, 4)) AS `rateIn`, - cast(sum(`e`.`amountOut`) AS decimal(10, 2)) AS `amountOut`, - cast(sum(`e`.`rateOut`) AS decimal(10, 4)) AS `rateOut`, - cast(sum(`e`.`amountEntry`) AS decimal(10, 2)) AS `amountEntry`, - cast(sum(`e`.`rateEntry`) AS decimal(10, 4)) AS `rateEntry`, - cast( - IFNULL(`rr`.`value`, `rrc`.`simulatedValue`) AS decimal(10, 4) - ) AS `rateECB` -FROM ( - ( - `vn`.`exchangeReportSourcePrevious` `e` - LEFT JOIN `vn`.`referenceRate` `rr` ON(`rr`.`dated` = `e`.`dated`) - ) - JOIN `vn`.`referenceRateConfig` `rrc` ON(1) - ) -GROUP BY `e`.`dated` -ORDER BY `e`.`dated` diff --git a/db/routines/vn/views/exchangeReportSourcePrevious.sql b/db/routines/vn/views/exchangeReportSourcePrevious.sql deleted file mode 100644 index b9e8ba8c1..000000000 --- a/db/routines/vn/views/exchangeReportSourcePrevious.sql +++ /dev/null @@ -1,29 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn`.`exchangeReportSourcePrevious` -AS SELECT `exchangeInsuranceIn`.`dated` AS `dated`, - `exchangeInsuranceIn`.`amount` AS `amountIn`, - `exchangeInsuranceIn`.`rate` AS `rateIn`, - 0.00 AS `amountOut`, - 0.00 AS `rateOut`, - 0.00 AS `amountEntry`, - 0.00 AS `rateEntry` -FROM `vn`.`exchangeInsuranceIn` -UNION ALL -SELECT `exchangeInsuranceOut`.`received` AS `received`, - 0.00 AS `amountIn`, - 0.00 AS `ratedIn`, - `exchangeInsuranceOut`.`divisa` AS `amountOut`, - `exchangeInsuranceOut`.`rate` AS `ratedOut`, - 0.00 AS `amountEntry`, - 0.00 AS `rateEntry` -FROM `vn`.`exchangeInsuranceOut` -UNION ALL -SELECT `exchangeInsuranceEntry`.`dated` AS `dated`, - 0.00 AS `amountIn`, - 0.00 AS `ratedIn`, - 0.00 AS `amountOut`, - 0.00 AS `ratedOut`, - `exchangeInsuranceEntry`.`Dolares` AS `amountEntry`, - `exchangeInsuranceEntry`.`rate` AS `rateEntry` -FROM `vn`.`exchangeInsuranceEntry` diff --git a/db/routines/vn2008/views/albaran.sql b/db/routines/vn2008/views/albaran.sql index 51a7c77e9..b1055ff56 100644 --- a/db/routines/vn2008/views/albaran.sql +++ b/db/routines/vn2008/views/albaran.sql @@ -14,6 +14,5 @@ AS SELECT `dn`.`id` AS `albaran_id`, `dn`.`workerFk` AS `Id_Trabajador`, `dn`.`supervisorFk` AS `Id_Responsable`, `dn`.`departmentFk` AS `department_id`, - `dn`.`invoiceInFk` AS `recibida_id`, - `dn`.`farmingFk` AS `farmingFk` + `dn`.`invoiceInFk` AS `recibida_id` FROM `vn`.`deliveryNote` `dn` diff --git a/db/versions/11038-yellowFern/00-firstScript.sql b/db/versions/11038-yellowFern/00-firstScript.sql new file mode 100644 index 000000000..daaae883c --- /dev/null +++ b/db/versions/11038-yellowFern/00-firstScript.sql @@ -0,0 +1 @@ +ALTER TABLE vn.deliveryNote CHANGE farmingFk farmingFk__ int(10) unsigned DEFAULT NULL NULL; From edb024a1f9b95b67d36fbe458c3282a8fe4a22a8 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Tue, 14 May 2024 10:14:53 +0200 Subject: [PATCH 04/17] refs #6106 hotFix: getTickets --- modules/route/back/methods/route/getTickets.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/modules/route/back/methods/route/getTickets.js b/modules/route/back/methods/route/getTickets.js index 0e7c9fe20..c0b952b70 100644 --- a/modules/route/back/methods/route/getTickets.js +++ b/modules/route/back/methods/route/getTickets.js @@ -87,10 +87,6 @@ module.exports = Self => { const where = filter.where; where['r.id'] = filter.id; - where.and = [{or: [ - {'t.packages': {gt: 0}}, - {and: [{'ot.code': 'delivery'}, {'tob.observationTypeFk': {neq: null}}]} - ]}]; stmt.merge(conn.makeWhere(filter.where)); stmt.merge(conn.makeGroupBy('t.id')); From eadf13b66325c53f36e6bacbb04baf3392e56b20 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 14 May 2024 12:20:39 +0200 Subject: [PATCH 05/17] fix: Jenkinsfile display BRANCH_NAME --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9d5954f86..8a079d35b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -24,7 +24,6 @@ node { FROM_GIT = env.JOB_NAME.startsWith('gitea/') RUN_TESTS = !PROTECTED_BRANCH && FROM_GIT RUN_BUILD = PROTECTED_BRANCH && FROM_GIT - // env.DEBUG = 'strong-remoting:shared-method' // https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#using-environment-variables echo "NODE_NAME: ${env.NODE_NAME}" echo "WORKSPACE: ${env.WORKSPACE}" @@ -162,6 +161,7 @@ pipeline { def packageJson = readJSON file: 'package.json' env.VERSION = packageJson.version } + echo "BRANCH_NAME: ${env.BRANCH_NAME}" sh 'gulp build' sh 'docker-compose build front' } From b6f788a8db3fe6355a2b1aa8f84ff2f0d80f351c Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 14 May 2024 14:21:16 +0200 Subject: [PATCH 06/17] fix: refs #7389 pbx.sipConfig: rename incomingLimit to call-limit --- db/routines/pbx/views/sipConf.sql | 2 +- db/versions/11051-blueAralia/00-sipConfig_callLimit.sql | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 db/versions/11051-blueAralia/00-sipConfig_callLimit.sql diff --git a/db/routines/pbx/views/sipConf.sql b/db/routines/pbx/views/sipConf.sql index 443cf7bee..0765264bc 100644 --- a/db/routines/pbx/views/sipConf.sql +++ b/db/routines/pbx/views/sipConf.sql @@ -12,7 +12,7 @@ AS SELECT `s`.`user_id` AS `id`, `c`.`permit` AS `permit`, `c`.`type` AS `type`, `c`.`context` AS `context`, - `c`.`incomingLimit` AS `incominglimit`, + `c`.`call-limit` AS `call-limit`, `c`.`pickupGroup` AS `pickupgroup`, `c`.`directMedia` AS `directmedia`, `c`.`insecure` AS `insecure`, diff --git a/db/versions/11051-blueAralia/00-sipConfig_callLimit.sql b/db/versions/11051-blueAralia/00-sipConfig_callLimit.sql new file mode 100644 index 000000000..9fbb7bb90 --- /dev/null +++ b/db/versions/11051-blueAralia/00-sipConfig_callLimit.sql @@ -0,0 +1,3 @@ +ALTER TABLE pbx.sipConfig + CHANGE incomingLimit `call-limit` varchar(10) + CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL; From d0d710f023107a1c35c9f48009d1eb5d91ef2797 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Tue, 14 May 2024 15:36:09 +0200 Subject: [PATCH 07/17] refs #6974 refactorLoop --- db/routines/bs/procedures/sale_add.sql | 94 ++++++++++++-------------- 1 file changed, 42 insertions(+), 52 deletions(-) diff --git a/db/routines/bs/procedures/sale_add.sql b/db/routines/bs/procedures/sale_add.sql index 64beb4776..823ece079 100644 --- a/db/routines/bs/procedures/sale_add.sql +++ b/db/routines/bs/procedures/sale_add.sql @@ -1,7 +1,8 @@ DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`sale_add`( IN vStarted DATE, - IN vEnded DATE) + IN vEnded DATE +) BEGIN /** * Añade las ventas que se realizaron entre 2 fechas a la tabla bs.sale @@ -10,63 +11,52 @@ BEGIN * @param vEnded Fecha de fin * */ - DECLARE vLoopDate DATE; - DECLARE vLoopDateTime DATETIME; - IF vStarted < (util.VN_CURDATE() - INTERVAL 5 YEAR) OR vStarted > vEnded THEN CALL util.throw('Wrong date'); END IF; - SET vLoopDate = vStarted; - DELETE FROM sale WHERE dated BETWEEN vStarted AND vEnded; - WHILE vLoopDate <= vEnded DO - SET vLoopDateTime = util.dayEnd(vLoopDate); - - REPLACE sale( - saleFk, - amount, - surcharge, - dated, - typeFk, - clientFk, - companyFk, - margin - )WITH calculatedSales AS( - SELECT s.id saleFk, - SUM(IF(ct.isBase, s.quantity * sc.value, 0)) amount, - SUM(IF(ct.isBase, 0, s.quantity * sc.value)) surcharge, - s.total pvp, - DATE(t.shipped) dated, - i.typeFk, - t.clientFk, - t.companyFk, - SUM(IF(ct.isMargin, s.quantity * sc.value, 0 )) marginComponents - FROM vn.ticket t - STRAIGHT_JOIN vn.sale s ON s.ticketFk = t.id - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.itemType it ON it.id = i.typeFk - JOIN vn.itemCategory ic ON ic.id = it.categoryFk - JOIN vn.saleComponent sc ON sc.saleFk = s.id - JOIN vn.component c ON c.id = sc.componentFk - JOIN vn.componentType ct ON ct.id = c.typeFk - WHERE t.shipped BETWEEN vLoopDate AND vLoopDateTime - AND s.quantity <> 0 - AND ic.merchandise - GROUP BY s.id - )SELECT saleFk, - amount, - surcharge, - dated, - typeFk, - clientFk, - companyFk, - marginComponents + amount + surcharge - pvp - FROM calculatedSales; - - SET vLoopDate = vLoopDate + INTERVAL 1 DAY; - END WHILE; + REPLACE sale( + saleFk, + amount, + surcharge, + dated, + typeFk, + clientFk, + companyFk, + margin + )WITH calculatedSales AS( + SELECT s.id saleFk, + CAST(SUM(IF(ct.isBase, s.quantity * sc.value, 0)) AS DECIMAL(10, 3)) amount, + CAST(SUM(IF(ct.isBase, 0, s.quantity * sc.value)) AS DECIMAL(10, 3)) surcharge, + s.total, + DATE(t.shipped) dated, + i.typeFk, + t.clientFk, + t.companyFk, + CAST(SUM(IF(ct.isMargin, s.quantity * sc.value, 0 )) AS DECIMAL(10, 3)) marginComponents + FROM vn.ticket t + STRAIGHT_JOIN vn.sale s ON s.ticketFk = t.id + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.itemType it ON it.id = i.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + JOIN vn.saleComponent sc ON sc.saleFk = s.id + JOIN vn.component c ON c.id = sc.componentFk + JOIN vn.componentType ct ON ct.id = c.typeFk + WHERE t.shipped BETWEEN vStarted AND vEnded + AND s.quantity <> 0 + AND ic.merchandise + GROUP BY s.id + )SELECT saleFk, + amount, + surcharge, + dated, + typeFk, + clientFk, + companyFk, + IF (marginComponents IS NULL, 0, CAST(marginComponents + amount + surcharge - total AS DECIMAL(10, 3))) + FROM calculatedSales; END$$ DELIMITER ; From adaba6ecfb6eb4c3c7a6d47b15ad10cfda33140d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Tue, 14 May 2024 15:39:28 +0200 Subject: [PATCH 08/17] refs #6974 refactor: optimize sale_add --- db/routines/bs/procedures/sale_add.sql | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/db/routines/bs/procedures/sale_add.sql b/db/routines/bs/procedures/sale_add.sql index 823ece079..c50d27b81 100644 --- a/db/routines/bs/procedures/sale_add.sql +++ b/db/routines/bs/procedures/sale_add.sql @@ -56,7 +56,9 @@ BEGIN typeFk, clientFk, companyFk, - IF (marginComponents IS NULL, 0, CAST(marginComponents + amount + surcharge - total AS DECIMAL(10, 3))) + IF (marginComponents IS NULL, + 0, + CAST(marginComponents + amount + surcharge - total AS DECIMAL(10, 3))) FROM calculatedSales; END$$ DELIMITER ; From 022d78e76c3a5eacba0777019bf64fbf99c81215 Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 15 May 2024 07:53:42 +0200 Subject: [PATCH 09/17] hotFix: fix env --- docker-compose.yml | 1 + front/Dockerfile | 3 +- front/env.template.js | 3 ++ front/nginx-entrypoint.sh | 7 +++++ front/salix/index.ejs | 2 ++ gulpfile.js | 9 ++++++ package.json | 2 ++ pnpm-lock.yaml | 60 ++++++++++++++++++++++++++++++++++++++- webpack.config.js | 3 -- 9 files changed, 85 insertions(+), 5 deletions(-) create mode 100644 front/env.template.js create mode 100644 front/nginx-entrypoint.sh diff --git a/docker-compose.yml b/docker-compose.yml index 5bb168093..ec40311c0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,6 +6,7 @@ services: context: front environment: - TZ + - NODE_ENV ports: - 80 deploy: diff --git a/front/Dockerfile b/front/Dockerfile index c507d863c..e0a43c412 100644 --- a/front/Dockerfile +++ b/front/Dockerfile @@ -14,5 +14,6 @@ COPY nginx.conf sites-available/salix RUN rm sites-enabled/default && ln -s ../sites-available/salix sites-enabled/salix COPY dist /salix/dist +COPY nginx-entrypoint.sh / -CMD ["nginx", "-g", "daemon off;"] +ENTRYPOINT [ "sh", "/nginx-entrypoint.sh" ] diff --git a/front/env.template.js b/front/env.template.js new file mode 100644 index 000000000..dbeb2f67b --- /dev/null +++ b/front/env.template.js @@ -0,0 +1,3 @@ +window.process = { + env: {NODE_ENV: '${NODE_ENV}'} +}; diff --git a/front/nginx-entrypoint.sh b/front/nginx-entrypoint.sh new file mode 100644 index 000000000..b931ae77a --- /dev/null +++ b/front/nginx-entrypoint.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +WWW_DIR=/usr/share/nginx/html +INJECT_FILE_SRC="${WWW_DIR}/env.template.js" +INJECT_FILE_DST="${WWW_DIR}/env.js" +envsubst < "${INJECT_FILE_SRC}" > "${INJECT_FILE_DST}" +[ -z "$@" ] && nginx -g 'daemon off;' || $@ diff --git a/front/salix/index.ejs b/front/salix/index.ejs index 3aed9d9a6..87a59ef86 100644 --- a/front/salix/index.ejs +++ b/front/salix/index.ejs @@ -5,6 +5,8 @@ + diff --git a/gulpfile.js b/gulpfile.js index aa2b65bc1..adfa66715 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -138,6 +138,9 @@ function webpack(done) { webpack.description = `Transpiles application into files`; function webpackDevServer(done) { + const replace = require('gulp-replace'); + const rename = require('gulp-rename'); + const webpack = require('webpack'); const merge = require('webpack-merge'); const WebpackDevServer = require('webpack-dev-server'); @@ -147,6 +150,12 @@ function webpackDevServer(done) { let devServer = wpConfig.devServer; + // local env + gulp.src(srcDir + '/env.template.js') + .pipe(replace('${NODE_ENV}', 'development')) + .pipe(rename('env.js')) + .pipe(gulp.dest(buildDir)); + for (let entryName in wpConfig.entry) { let entry = wpConfig.entry[entryName]; if (!Array.isArray(entry)) diff --git a/package.json b/package.json index 033eafc40..ced56412b 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,8 @@ "ftps": "^1.2.0", "gm": "^1.25.0", "got": "^10.7.0", + "gulp-rename": "^2.0.0", + "gulp-replace": "^1.1.4", "helmet": "^3.21.2", "i18n": "^0.8.4", "imap": "^0.8.19", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d3959ac03..4c0d4924b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -35,6 +35,12 @@ dependencies: got: specifier: ^10.7.0 version: 10.7.0 + gulp-rename: + specifier: ^2.0.0 + version: 2.0.0 + gulp-replace: + specifier: ^1.1.4 + version: 1.1.4 helmet: specifier: ^3.21.2 version: 3.23.3 @@ -2629,6 +2635,10 @@ packages: resolution: {integrity: sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==} dev: true + /@types/expect@1.20.4: + resolution: {integrity: sha512-Q5Vn3yjTDyCMV50TB6VRIbQNxSE4OmZR86VSbGaNpfUolm0iePBB4KdEEHmxoY5sT2+2DIvXW0rvMDP2nHZ4Mg==} + dev: false + /@types/express-serve-static-core@4.17.42: resolution: {integrity: sha512-ckM3jm2bf/MfB3+spLPWYPUH573plBFwpOhqQ2WottxYV85j1HQFlxmnTq57X1yHY9awZPig06hL/cLMgNWHIQ==} dependencies: @@ -2787,6 +2797,13 @@ packages: resolution: {integrity: sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA==} dev: false + /@types/vinyl@2.0.12: + resolution: {integrity: sha512-Sr2fYMBUVGYq8kj3UthXFAu5UN6ZW+rYr4NACjZQJvHvj+c8lYv0CahmZ2P/r7iUkN44gGUBwqxZkrKXYPb7cw==} + dependencies: + '@types/expect': 1.20.4 + '@types/node': 20.11.16 + dev: false + /@types/yargs-parser@21.0.3: resolution: {integrity: sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==} dev: true @@ -3767,6 +3784,11 @@ packages: engines: {node: '>=8'} dev: true + /binaryextensions@2.3.0: + resolution: {integrity: sha512-nAihlQsYGyc5Bwq6+EsubvANYGExeJKHDO3RjnvwU042fawQTQfM3Kxn7IHUXQOz4bzfwsGYYHGSvXyW4zOGLg==} + engines: {node: '>=0.8'} + dev: false + /bindings@1.5.0: resolution: {integrity: sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==} requiresBuild: true @@ -7087,6 +7109,22 @@ packages: map-stream: 0.0.7 dev: true + /gulp-rename@2.0.0: + resolution: {integrity: sha512-97Vba4KBzbYmR5VBs9mWmK+HwIf5mj+/zioxfZhOKeXtx5ZjBk57KFlePf5nxq9QsTtFl0ejnHE3zTC9MHXqyQ==} + engines: {node: '>=4'} + dev: false + + /gulp-replace@1.1.4: + resolution: {integrity: sha512-SVSF7ikuWKhpAW4l4wapAqPPSToJoiNKsbDoUnRrSgwZHH7lH8pbPeQj1aOVYQrbZKhfSVBxVW+Py7vtulRktw==} + engines: {node: '>=10'} + dependencies: + '@types/node': 20.11.16 + '@types/vinyl': 2.0.12 + istextorbinary: 3.3.0 + replacestream: 4.0.3 + yargs-parser: 21.1.1 + dev: false + /gulp-util@3.0.8: resolution: {integrity: sha512-q5oWPc12lwSFS9h/4VIjG+1NuNDlJ48ywV2JKItY4Ycc/n1fXJeYPVQsfu5ZrhQi7FGSDBalwUCLar/GyHXKGw==} engines: {node: '>=0.10'} @@ -8321,6 +8359,14 @@ packages: istanbul-lib-report: 3.0.1 dev: true + /istextorbinary@3.3.0: + resolution: {integrity: sha512-Tvq1W6NAcZeJ8op+Hq7tdZ434rqnMx4CCZ7H0ff83uEloDvVbqAwaMTZcafKGJT0VHkYzuXUiCY4hlXQg6WfoQ==} + engines: {node: '>=8'} + dependencies: + binaryextensions: 2.3.0 + textextensions: 3.3.0 + dev: false + /jackspeak@2.3.6: resolution: {integrity: sha512-N3yCS/NegsOBokc8GAdM8UcmfsKiSS8cipheD/nivzr700H+nsMOxJjQnvwOcRYVuFkdH0wGUvW2WbXGmrZGbQ==} engines: {node: '>=14'} @@ -10783,7 +10829,6 @@ packages: /object-assign@4.1.1: resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==} engines: {node: '>=0.10.0'} - dev: true /object-copy@0.1.0: resolution: {integrity: sha512-79LYn6VAb63zgtmAteVOWo9Vdj71ZVBy3Pbse+VqxDpEP83XuujMrGqHIwAXJ5I/aM0zU7dIyIAhifVTPrNItQ==} @@ -12058,6 +12103,14 @@ packages: remove-trailing-separator: 1.1.0 dev: true + /replacestream@4.0.3: + resolution: {integrity: sha512-AC0FiLS352pBBiZhd4VXB1Ab/lh0lEgpP+GGvZqbQh8a5cmXVoTe5EX/YeTFArnp4SRGTHh1qCHu9lGs1qG8sA==} + dependencies: + escape-string-regexp: 1.0.5 + object-assign: 4.1.1 + readable-stream: 2.3.8 + dev: false + /request@2.88.2: resolution: {integrity: sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==} engines: {node: '>= 6'} @@ -13556,6 +13609,11 @@ packages: resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==} dev: true + /textextensions@3.3.0: + resolution: {integrity: sha512-mk82dS8eRABNbeVJrEiN5/UMSCliINAuz8mkUwH4SwslkNP//gbEzlWNS5au0z5Dpx40SQxzqZevZkn+WYJ9Dw==} + engines: {node: '>=8'} + dev: false + /throat@5.0.0: resolution: {integrity: sha512-fcwX4mndzpLQKBS1DVYhGAcYaYt7vsHNIvQV+WXMvnow5cgjPphq5CaayLaGsjRdSCKZFNGt7/GYAuXaNOiYCA==} dev: true diff --git a/webpack.config.js b/webpack.config.js index 7296a62d1..5c5ca0a55 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -99,9 +99,6 @@ let baseConfig = { filename: 'index.html', chunks: ['salix'] }), - new webpack.DefinePlugin({ - 'process.env.NODE_ENV': JSON.stringify(env) - }) ], devtool: 'source-map', stats: { From f368e00677bc8d2007dca47a016d924f22f3a6c6 Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 15 May 2024 09:02:23 +0200 Subject: [PATCH 10/17] hotFix: fix env --- front/Dockerfile | 1 + front/nginx-entrypoint.sh | 2 +- package.json | 4 ++-- pnpm-lock.yaml | 29 +++++++++++++++-------------- 4 files changed, 19 insertions(+), 17 deletions(-) diff --git a/front/Dockerfile b/front/Dockerfile index e0a43c412..19a058cf1 100644 --- a/front/Dockerfile +++ b/front/Dockerfile @@ -14,6 +14,7 @@ COPY nginx.conf sites-available/salix RUN rm sites-enabled/default && ln -s ../sites-available/salix sites-enabled/salix COPY dist /salix/dist +COPY env.template.js /salix/dist COPY nginx-entrypoint.sh / ENTRYPOINT [ "sh", "/nginx-entrypoint.sh" ] diff --git a/front/nginx-entrypoint.sh b/front/nginx-entrypoint.sh index b931ae77a..a6d2b744a 100644 --- a/front/nginx-entrypoint.sh +++ b/front/nginx-entrypoint.sh @@ -1,6 +1,6 @@ #!/bin/sh -WWW_DIR=/usr/share/nginx/html +WWW_DIR=/salix/dist INJECT_FILE_SRC="${WWW_DIR}/env.template.js" INJECT_FILE_DST="${WWW_DIR}/env.js" envsubst < "${INJECT_FILE_SRC}" > "${INJECT_FILE_DST}" diff --git a/package.json b/package.json index ced56412b..f6cec44ab 100644 --- a/package.json +++ b/package.json @@ -23,8 +23,6 @@ "ftps": "^1.2.0", "gm": "^1.25.0", "got": "^10.7.0", - "gulp-rename": "^2.0.0", - "gulp-replace": "^1.1.4", "helmet": "^3.21.2", "i18n": "^0.8.4", "imap": "^0.8.19", @@ -83,6 +81,8 @@ "gulp-print": "^2.0.1", "gulp-wrap": "^0.15.0", "gulp-yaml": "^1.0.1", + "gulp-rename": "^2.0.0", + "gulp-replace": "^1.1.4", "html-loader": "^0.4.5", "html-loader-jest": "^0.2.1", "html-webpack-plugin": "^5.5.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4c0d4924b..b6634196e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -35,12 +35,6 @@ dependencies: got: specifier: ^10.7.0 version: 10.7.0 - gulp-rename: - specifier: ^2.0.0 - version: 2.0.0 - gulp-replace: - specifier: ^1.1.4 - version: 1.1.4 helmet: specifier: ^3.21.2 version: 3.23.3 @@ -205,6 +199,12 @@ devDependencies: gulp-print: specifier: ^2.0.1 version: 2.0.1 + gulp-rename: + specifier: ^2.0.0 + version: 2.0.0 + gulp-replace: + specifier: ^1.1.4 + version: 1.1.4 gulp-wrap: specifier: ^0.15.0 version: 0.15.0(ejs@2.3.1) @@ -2637,7 +2637,7 @@ packages: /@types/expect@1.20.4: resolution: {integrity: sha512-Q5Vn3yjTDyCMV50TB6VRIbQNxSE4OmZR86VSbGaNpfUolm0iePBB4KdEEHmxoY5sT2+2DIvXW0rvMDP2nHZ4Mg==} - dev: false + dev: true /@types/express-serve-static-core@4.17.42: resolution: {integrity: sha512-ckM3jm2bf/MfB3+spLPWYPUH573plBFwpOhqQ2WottxYV85j1HQFlxmnTq57X1yHY9awZPig06hL/cLMgNWHIQ==} @@ -2802,7 +2802,7 @@ packages: dependencies: '@types/expect': 1.20.4 '@types/node': 20.11.16 - dev: false + dev: true /@types/yargs-parser@21.0.3: resolution: {integrity: sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==} @@ -3787,7 +3787,7 @@ packages: /binaryextensions@2.3.0: resolution: {integrity: sha512-nAihlQsYGyc5Bwq6+EsubvANYGExeJKHDO3RjnvwU042fawQTQfM3Kxn7IHUXQOz4bzfwsGYYHGSvXyW4zOGLg==} engines: {node: '>=0.8'} - dev: false + dev: true /bindings@1.5.0: resolution: {integrity: sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==} @@ -7112,7 +7112,7 @@ packages: /gulp-rename@2.0.0: resolution: {integrity: sha512-97Vba4KBzbYmR5VBs9mWmK+HwIf5mj+/zioxfZhOKeXtx5ZjBk57KFlePf5nxq9QsTtFl0ejnHE3zTC9MHXqyQ==} engines: {node: '>=4'} - dev: false + dev: true /gulp-replace@1.1.4: resolution: {integrity: sha512-SVSF7ikuWKhpAW4l4wapAqPPSToJoiNKsbDoUnRrSgwZHH7lH8pbPeQj1aOVYQrbZKhfSVBxVW+Py7vtulRktw==} @@ -7123,7 +7123,7 @@ packages: istextorbinary: 3.3.0 replacestream: 4.0.3 yargs-parser: 21.1.1 - dev: false + dev: true /gulp-util@3.0.8: resolution: {integrity: sha512-q5oWPc12lwSFS9h/4VIjG+1NuNDlJ48ywV2JKItY4Ycc/n1fXJeYPVQsfu5ZrhQi7FGSDBalwUCLar/GyHXKGw==} @@ -8365,7 +8365,7 @@ packages: dependencies: binaryextensions: 2.3.0 textextensions: 3.3.0 - dev: false + dev: true /jackspeak@2.3.6: resolution: {integrity: sha512-N3yCS/NegsOBokc8GAdM8UcmfsKiSS8cipheD/nivzr700H+nsMOxJjQnvwOcRYVuFkdH0wGUvW2WbXGmrZGbQ==} @@ -10829,6 +10829,7 @@ packages: /object-assign@4.1.1: resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==} engines: {node: '>=0.10.0'} + dev: true /object-copy@0.1.0: resolution: {integrity: sha512-79LYn6VAb63zgtmAteVOWo9Vdj71ZVBy3Pbse+VqxDpEP83XuujMrGqHIwAXJ5I/aM0zU7dIyIAhifVTPrNItQ==} @@ -12109,7 +12110,7 @@ packages: escape-string-regexp: 1.0.5 object-assign: 4.1.1 readable-stream: 2.3.8 - dev: false + dev: true /request@2.88.2: resolution: {integrity: sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==} @@ -13612,7 +13613,7 @@ packages: /textextensions@3.3.0: resolution: {integrity: sha512-mk82dS8eRABNbeVJrEiN5/UMSCliINAuz8mkUwH4SwslkNP//gbEzlWNS5au0z5Dpx40SQxzqZevZkn+WYJ9Dw==} engines: {node: '>=8'} - dev: false + dev: true /throat@5.0.0: resolution: {integrity: sha512-fcwX4mndzpLQKBS1DVYhGAcYaYt7vsHNIvQV+WXMvnow5cgjPphq5CaayLaGsjRdSCKZFNGt7/GYAuXaNOiYCA==} From f442f0dafb1de9ad2855b3cc8ba9f2a2f87b271b Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 15 May 2024 11:52:50 +0200 Subject: [PATCH 11/17] hotFix(env): refs #7388 install gettext-base --- front/Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/front/Dockerfile b/front/Dockerfile index 19a058cf1..db1cb0673 100644 --- a/front/Dockerfile +++ b/front/Dockerfile @@ -4,7 +4,9 @@ ENV TZ Europe/Madrid ARG DEBIAN_FRONTEND=noninteractive RUN apt-get update \ - && apt-get install -y --no-install-recommends nginx \ + && apt-get install -y --no-install-recommends \ + nginx \ + gettext-base \ && rm -rf /var/lib/apt/lists/* \ && ln -sf /dev/stdout /var/log/nginx/access.log \ && ln -sf /dev/stderr /var/log/nginx/error.log From dcc943e82d5969aaed8ea347e12590ecda16a988 Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 15 May 2024 12:19:01 +0200 Subject: [PATCH 12/17] hotFix(env): refs #7388 disable webpack nodeEnv --- Jenkinsfile | 1 - webpack.config.js | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8a079d35b..6f0a642b4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -161,7 +161,6 @@ pipeline { def packageJson = readJSON file: 'package.json' env.VERSION = packageJson.version } - echo "BRANCH_NAME: ${env.BRANCH_NAME}" sh 'gulp build' sh 'docker-compose build front' } diff --git a/webpack.config.js b/webpack.config.js index 5c5ca0a55..2c01a10eb 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -70,6 +70,7 @@ let baseConfig = { ] }, optimization: { + nodeEnv: false, runtimeChunk: true, splitChunks: { chunks: 'all', From a4e1b1931c07a75be721666e5647b3188b9aa27b Mon Sep 17 00:00:00 2001 From: carlossa Date: Wed, 15 May 2024 12:38:30 +0200 Subject: [PATCH 13/17] hotfix accessScopes --- modules/client/back/methods/client/clientDebtStatementPdf.js | 3 ++- modules/client/back/methods/client/createReceipt.js | 4 +++- modules/client/back/methods/client/creditRequestPdf.js | 3 ++- .../client/back/methods/client/incotermsAuthorizationPdf.js | 3 ++- modules/client/back/methods/client/letterDebtorPdf.js | 3 ++- modules/client/back/methods/receipt/balanceCompensationPdf.js | 3 ++- modules/client/back/methods/receipt/receiptPdf.js | 3 ++- modules/invoiceOut/back/methods/invoiceOut/invoiceOutPdf.js | 3 ++- modules/item/back/methods/item/labelPdf.js | 3 ++- 9 files changed, 19 insertions(+), 9 deletions(-) diff --git a/modules/client/back/methods/client/clientDebtStatementPdf.js b/modules/client/back/methods/client/clientDebtStatementPdf.js index 845527ace..ebe28affc 100644 --- a/modules/client/back/methods/client/clientDebtStatementPdf.js +++ b/modules/client/back/methods/client/clientDebtStatementPdf.js @@ -40,7 +40,8 @@ module.exports = Self => { http: { path: '/:id/client-debt-statement-pdf', verb: 'GET' - } + }, + accessScopes: ['DEFAULT', 'read:multimedia'] }); Self.clientDebtStatementPdf = (ctx, id) => Self.printReport(ctx, id, 'client-debt-statement'); diff --git a/modules/client/back/methods/client/createReceipt.js b/modules/client/back/methods/client/createReceipt.js index debdaf066..e2a57272b 100644 --- a/modules/client/back/methods/client/createReceipt.js +++ b/modules/client/back/methods/client/createReceipt.js @@ -3,6 +3,7 @@ const UserError = require('vn-loopback/util/user-error'); module.exports = function(Self) { Self.remoteMethodCtx('createReceipt', { description: 'Creates receipt and its compensation if necessary', + accessType: 'READ', accepts: [{ arg: 'clientFk', type: 'number', @@ -45,7 +46,8 @@ module.exports = function(Self) { http: { verb: 'post', path: '/:clientFk/createReceipt' - } + }, + accessScopes: ['DEFAULT', 'read:multimedia'] }); Self.createReceipt = async(ctx, options) => { diff --git a/modules/client/back/methods/client/creditRequestPdf.js b/modules/client/back/methods/client/creditRequestPdf.js index a4f4ed128..44c74dd7c 100644 --- a/modules/client/back/methods/client/creditRequestPdf.js +++ b/modules/client/back/methods/client/creditRequestPdf.js @@ -35,7 +35,8 @@ module.exports = Self => { http: { path: '/:id/credit-request-pdf', verb: 'GET' - } + }, + accessScopes: ['DEFAULT', 'read:multimedia'] }); Self.creditRequestPdf = (ctx, id) => Self.printReport(ctx, id, 'credit-request'); diff --git a/modules/client/back/methods/client/incotermsAuthorizationPdf.js b/modules/client/back/methods/client/incotermsAuthorizationPdf.js index ffe17c72f..59e9f5d5c 100644 --- a/modules/client/back/methods/client/incotermsAuthorizationPdf.js +++ b/modules/client/back/methods/client/incotermsAuthorizationPdf.js @@ -47,7 +47,8 @@ module.exports = Self => { http: { path: '/:id/incoterms-authorization-pdf', verb: 'GET' - } + }, + accessScopes: ['DEFAULT', 'read:multimedia'] }); Self.incotermsAuthorizationPdf = (ctx, id) => Self.printReport(ctx, id, 'incoterms-authorization'); diff --git a/modules/client/back/methods/client/letterDebtorPdf.js b/modules/client/back/methods/client/letterDebtorPdf.js index 943869143..0b7880e37 100644 --- a/modules/client/back/methods/client/letterDebtorPdf.js +++ b/modules/client/back/methods/client/letterDebtorPdf.js @@ -41,7 +41,8 @@ module.exports = Self => { http: { path: '/:id/letter-debtor-pdf', verb: 'GET' - } + }, + accessScopes: ['DEFAULT', 'read:multimedia'] }); Self.letterDebtorPdf = (ctx, id) => Self.printReport(ctx, id, 'letter-debtor'); diff --git a/modules/client/back/methods/receipt/balanceCompensationPdf.js b/modules/client/back/methods/receipt/balanceCompensationPdf.js index e790d54a1..74cbb01f6 100644 --- a/modules/client/back/methods/receipt/balanceCompensationPdf.js +++ b/modules/client/back/methods/receipt/balanceCompensationPdf.js @@ -29,7 +29,8 @@ module.exports = Self => { http: { path: '/:id/balance-compensation-pdf', verb: 'GET' - } + }, + accessScopes: ['DEFAULT', 'read:multimedia'] }); Self.balanceCompensationPdf = (ctx, id) => Self.printReport(ctx, id, 'balance-compensation'); diff --git a/modules/client/back/methods/receipt/receiptPdf.js b/modules/client/back/methods/receipt/receiptPdf.js index 6e49de22a..da33f1ed4 100644 --- a/modules/client/back/methods/receipt/receiptPdf.js +++ b/modules/client/back/methods/receipt/receiptPdf.js @@ -34,7 +34,8 @@ module.exports = Self => { http: { path: '/:id/receipt-pdf', verb: 'GET' - } + }, + accessScopes: ['DEFAULT', 'read:multimedia'] }); Self.receiptPdf = (ctx, id) => Self.printReport(ctx, id, 'receipt'); diff --git a/modules/invoiceOut/back/methods/invoiceOut/invoiceOutPdf.js b/modules/invoiceOut/back/methods/invoiceOut/invoiceOutPdf.js index 941d31596..f4bb6baa9 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/invoiceOutPdf.js +++ b/modules/invoiceOut/back/methods/invoiceOut/invoiceOutPdf.js @@ -31,7 +31,8 @@ module.exports = Self => { http: { path: '/:reference/invoice-out-pdf', verb: 'GET' - } + }, + accessScopes: ['DEFAULT', 'read:multimedia'] }); Self.invoiceOutPdf = async(ctx, reference) => { diff --git a/modules/item/back/methods/item/labelPdf.js b/modules/item/back/methods/item/labelPdf.js index c2462353d..d7a50397e 100644 --- a/modules/item/back/methods/item/labelPdf.js +++ b/modules/item/back/methods/item/labelPdf.js @@ -51,7 +51,8 @@ module.exports = Self => { http: { path: '/:id/label-pdf', verb: 'GET' - } + }, + accessScopes: ['DEFAULT', 'read:multimedia'] }); Self.labelPdf = (ctx, id) => Self.printReport(ctx, id, 'item-label'); From 4b8cad9aef4558792f40438d054d8c0801695d31 Mon Sep 17 00:00:00 2001 From: carlossa Date: Wed, 15 May 2024 13:23:36 +0200 Subject: [PATCH 14/17] hotfix accessScopes --- modules/ticket/back/methods/ticket/docuwareDownload.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/ticket/back/methods/ticket/docuwareDownload.js b/modules/ticket/back/methods/ticket/docuwareDownload.js index 7084bbdd4..f89509570 100644 --- a/modules/ticket/back/methods/ticket/docuwareDownload.js +++ b/modules/ticket/back/methods/ticket/docuwareDownload.js @@ -28,7 +28,8 @@ module.exports = Self => { http: { path: `/:id/docuwareDownload`, verb: 'GET' - } + }, + accessScopes: ['DEFAULT', 'read:multimedia'] }); Self.docuwareDownload = async id => { From 53fa78894cb5a08a973efd5b7da7677800a14581 Mon Sep 17 00:00:00 2001 From: guillermo Date: Wed, 15 May 2024 13:54:22 +0200 Subject: [PATCH 15/17] feat: refs #7264 Refactor proc itemShelvingRadar and added columns --- .../vn/procedures/itemShelvingRadar.sql | 251 +++++++++--------- 1 file changed, 132 insertions(+), 119 deletions(-) diff --git a/db/routines/vn/procedures/itemShelvingRadar.sql b/db/routines/vn/procedures/itemShelvingRadar.sql index c89a190ae..6cebefefe 100644 --- a/db/routines/vn/procedures/itemShelvingRadar.sql +++ b/db/routines/vn/procedures/itemShelvingRadar.sql @@ -2,7 +2,7 @@ DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelvingRadar`( vSectorFk INT ) -proc:BEGIN +BEGIN /** * Calcula la información detallada respecto un sector. * @@ -15,37 +15,24 @@ proc:BEGIN DECLARE vWarehouseFk INT DEFAULT 0; DECLARE vSonSectorFk INT; DECLARE vWorkerFk INT; - - SELECT s.workerFk - INTO vWorkerFk - FROM vn.sector s + + SELECT s.workerFk INTO vWorkerFk + FROM sector s WHERE s.id = vSectorFk; - SELECT w.id, s.warehouseFk INTO vBuyerFk, vWarehouseFk - FROM vn.worker w - JOIN vn.sector s ON s.code = w.code - WHERE s.id = vSectorFk; - - SELECT s.id INTO vSectorFk - FROM vn.sector s - WHERE s.warehouseFk = vWarehouseFk - AND s.isMain; - SELECT COUNT(*) INTO hasFatherSector - FROM vn.sector + FROM sector WHERE sonFk = vSectorFk; - + SELECT warehouseFk, sonFk INTO vWarehouseFk, vSonSectorFk - FROM vn.sector + FROM sector WHERE id = vSectorFk; - + CALL cache.visible_refresh(vCalcVisibleFk, TRUE, vWarehouseFk); CALL cache.available_refresh(vCalcAvailableFk, FALSE, vWarehouseFk, util.VN_CURDATE()); - - DROP TEMPORARY TABLE IF EXISTS tmp.itemShelvingRadar; - + IF hasFatherSector THEN - CREATE TEMPORARY TABLE tmp.itemShelvingRadar + CREATE OR REPLACE TEMPORARY TABLE tmp.itemShelvingRadar (PRIMARY KEY (itemFk)) ENGINE = MEMORY SELECT * @@ -54,57 +41,77 @@ proc:BEGIN i.longName, i.size, i.subName producer, - IFNULL(a.available,0) available, - SUM(IF(s.sonFk = vSectorFk, IFNULL(iss.visible,0), 0)) upstairs, - SUM(IF(iss.sectorFk = vSectorFk, IFNULL(iss.visible,0), 0)) downstairs, - IF(it.isPackaging, NULL, IFNULL(v.visible,0)) as visible, - vSectorFk sectorFk - FROM vn.itemShelvingStock iss - JOIN vn.sector s ON s.id = iss.sectorFk - JOIN vn.item i on i.id = iss.itemFk - JOIN vn.itemType it ON it.id = i.typeFk AND vBuyerFk IN (0,it.workerFk) - LEFT JOIN cache.available a ON a.item_id = iss.itemFk AND a.calc_id = vCalcAvailableFk - LEFT JOIN cache.visible v ON v.item_id = iss.itemFk AND v.calc_id = vCalcVisibleFk + IFNULL(a.available, 0) available, + SUM(IF(s.sonFk = vSectorFk, IFNULL(iss.visible, 0), 0)) upstairs, + SUM(IF(iss.sectorFk = vSectorFk, IFNULL(iss.visible, 0), 0)) downstairs, + IF(it.isPackaging, NULL, IFNULL(v.visible, 0)) visible, + vSectorFk sectorFk, + ish.isChecked, + sub.isAllChecked + FROM itemShelvingStock iss + JOIN itemShelving ish ON ish.shelvingFk = iss.shelvingFk + LEFT JOIN ( + SELECT itemFk, + IF( + COUNT(*) = SUM(IF(isChecked >= 0, 1, 0)), + TRUE, + FALSE + ) isAllChecked + FROM itemShelving is2 + GROUP BY itemFk + ) sub ON sub.itemFk = ish.itemFk + JOIN sector s ON s.id = iss.sectorFk + JOIN item i ON i.id = iss.itemFk + JOIN itemType it ON it.id = i.typeFk + LEFT JOIN cache.available a ON a.item_id = iss.itemFk + AND a.calc_id = vCalcAvailableFk + LEFT JOIN cache.visible v ON v.item_id = iss.itemFk + AND v.calc_id = vCalcVisibleFk WHERE vSectorFk IN (iss.sectorFk, s.sonFk) GROUP BY iss.itemFk - UNION ALL - - SELECT v.item_id, + SELECT v.item_id, i.longName, i.size, - i.subName producer, - IFNULL(a.available,0) as available, - 0 upstairs, - 0 downstairs, - IF(it.isPackaging, NULL, v.visible) visible, - vSectorFk as sectorFk + i.subName, + IFNULL(a.available, 0), + 0, + 0, + IF(it.isPackaging, NULL, v.visible), + vSectorFk, + NULL, + NULL FROM cache.visible v - JOIN vn.item i on i.id = v.item_id - JOIN vn.itemType it ON it.id = i.typeFk AND vBuyerFk IN (0,it.workerFk) - LEFT JOIN vn.itemShelvingStock iss ON iss.itemFk = v.item_id AND iss.warehouseFk = vWarehouseFk - LEFT JOIN cache.available a ON a.item_id = v.item_id AND a.calc_id = vCalcAvailableFk + JOIN item i ON i.id = v.item_id + JOIN itemType it ON it.id = i.typeFk + LEFT JOIN itemShelvingStock iss ON iss.itemFk = v.item_id + AND iss.warehouseFk = vWarehouseFk + LEFT JOIN cache.available a ON a.item_id = v.item_id + AND a.calc_id = vCalcAvailableFk WHERE v.calc_id = vCalcVisibleFk AND iss.itemFk IS NULL AND it.isInventory - ) sub GROUP BY itemFk; + ) sub + GROUP BY itemFk; SELECT ishr.*, - CAST(visible - upstairs - downstairs AS DECIMAL(10,0)) AS nicho, - CAST(downstairs - IFNULL(notPickedYed,0) AS DECIMAL(10,0)) as pendiente - FROM tmp.itemShelvingRadar ishr - JOIN vn.item i ON i.id = ishr.itemFk - LEFT JOIN (SELECT s.itemFk, sum(s.quantity) as notPickedYed - FROM vn.ticket t - JOIN vn.ticketStateToday tst ON tst.ticketFk = t.id - JOIN vn.sale s ON s.ticketFk = t.id - WHERE t.warehouseFk = vWarehouseFk - AND tst.alertLevel = 0 - GROUP BY s.itemFk - ) sub ON sub.itemFk = ishr.itemFk - ORDER BY i.typeFk, i.longName; + CAST(visible - upstairs - downstairs AS DECIMAL(10, 0)) nicho, + CAST(downstairs - IFNULL(notPickedYed, 0) AS DECIMAL(10, 0)) pendiente + FROM tmp.itemShelvingRadar ishr + JOIN item i ON i.id = ishr.itemFk + LEFT JOIN ( + SELECT s.itemFk, SUM(s.quantity) notPickedYed + FROM ticket t + JOIN ticketStateToday tst ON tst.ticketFk = t.id + JOIN alertLevel al ON al.id = tst.alertLevel + JOIN sale s ON s.ticketFk = t.id + WHERE t.warehouseFk = vWarehouseFk + AND al.code = 'FREE' + GROUP BY s.itemFk + ) sub ON sub.itemFk = ishr.itemFk + ORDER BY i.typeFk, i.longName; ELSE - CREATE TEMPORARY TABLE tmp.itemShelvingRadar + CREATE OR REPLACE TEMPORARY TABLE tmp.itemShelvingRadar (PRIMARY KEY (itemFk)) ENGINE = MEMORY SELECT iss.itemFk, @@ -115,73 +122,79 @@ proc:BEGIN i.size, i.subName producer, i.upToDown, - IFNULL(a.available,0) available, - IFNULL(v.visible - iss.visible,0) dayEndVisible, - IFNULL(v.visible - iss.visible,0) firstNegative, - IFNULL(v.visible - iss.visible,0) itemPlacementVisible, - IFNULL(i.minimum * b.packing,0) itemPlacementSize, + IFNULL(a.available, 0) available, + IFNULL(v.visible - iss.visible, 0) dayEndVisible, + IFNULL(v.visible - iss.visible, 0) firstNegative, + IFNULL(v.visible - iss.visible, 0) itemPlacementVisible, + IFNULL(i.minimum * b.packing, 0) itemPlacementSize, ips.onTheWay, iss.visible itemShelvingStock, - IFNULL(v.visible,0) visible, + IFNULL(v.visible, 0) visible, b.isPickedOff, iss.sectorFk - FROM vn.itemShelvingStock iss - JOIN vn.item i on i.id = iss.itemFk - LEFT JOIN cache.last_buy lb ON lb.item_id = iss.itemFk AND lb.warehouse_id = vWarehouseFk - LEFT JOIN vn.buy b ON b.id = lb.buy_id - LEFT JOIN cache.available a ON a.item_id = iss.itemFk AND a.calc_id = vCalcAvailableFk - LEFT JOIN cache.visible v ON v.item_id = iss.itemFk AND v.calc_id = vCalcVisibleFk - LEFT JOIN (SELECT itemFk, sum(saldo) as onTheWay - FROM vn.itemPlacementSupplyList - WHERE saldo > 0 - GROUP BY itemFk - ) ips ON ips.itemFk = i.id - WHERE IFNULL(iss.sectorFk,0) IN (0, vSectorFk) - OR iss.sectorFk = vSectorFk; + FROM itemShelvingStock iss + JOIN item i ON i.id = iss.itemFk + LEFT JOIN cache.last_buy lb ON lb.item_id = iss.itemFk + AND lb.warehouse_id = vWarehouseFk + LEFT JOIN buy b ON b.id = lb.buy_id + LEFT JOIN cache.available a ON a.item_id = iss.itemFk + AND a.calc_id = vCalcAvailableFk + LEFT JOIN cache.visible v ON v.item_id = iss.itemFk + AND v.calc_id = vCalcVisibleFk + LEFT JOIN ( + SELECT itemFk, SUM(saldo) onTheWay + FROM itemPlacementSupplyList + WHERE saldo > 0 + GROUP BY itemFk + ) ips ON ips.itemFk = i.id + WHERE iss.sectorFk = vSectorFk + OR iss.sectorFk IS NULL; - DROP TEMPORARY TABLE IF EXISTS tmp.itemOutTime; - CREATE TEMPORARY TABLE tmp.itemOutTime - SELECT *,SUM(amount) quantity - FROM - (SELECT io.itemFk, - io.quantity amount, - IF(HOUR(t.shipped), HOUR(t.shipped), HOUR(z.`hour`)) as hours, - IF(MINUTE(t.shipped), MINUTE(t.shipped), MINUTE(z.`hour`)) as minutes - FROM itemTicketOut io - JOIN tmp.itemShelvingRadar isr ON isr.itemFk = io.itemFk - JOIN vn.ticket t on t.id= io.ticketFk - JOIN vn.ticketState ts on ts.ticketFk = io.ticketFk - JOIN vn.state s ON s.id = ts.stateFk - LEFT JOIN vn.zone z ON z.id = t.zoneFk - LEFT JOIN (SELECT DISTINCT saleFk - FROM vn.saleTracking st - WHERE st.created > util.VN_CURDATE() - AND st.isChecked - ) stPrevious ON `stPrevious`.`saleFk` = io.saleFk - WHERE t.warehouseFk = vWarehouseFk - AND s.isPicked = 0 - AND NOT io.reserved - AND stPrevious.saleFk IS NULL - AND io.shipped >= util.VN_CURDATE() - AND io.shipped < util.VN_CURDATE() + INTERVAL 1 DAY - ) sub - GROUP BY itemFk, hours, minutes; + CREATE OR REPLACE TEMPORARY TABLE tmp.itemOutTime + SELECT *, SUM(amount) quantity + FROM ( + SELECT io.itemFk, + io.quantity amount, + IF(HOUR(t.shipped), HOUR(t.shipped), HOUR(z.`hour`)) `hours`, + IF(MINUTE(t.shipped), MINUTE(t.shipped), MINUTE(z.`hour`)) `minutes` + FROM itemTicketOut `io` + JOIN tmp.itemShelvingRadar isr ON isr.itemFk = io.itemFk + JOIN ticket t ON t.id= io.ticketFk + JOIN ticketState ts ON ts.ticketFk = io.ticketFk + JOIN `state` s ON s.id = ts.stateFk + LEFT JOIN `zone` z ON z.id = t.zoneFk + LEFT JOIN ( + SELECT DISTINCT saleFk + FROM saleTracking st + WHERE st.created > util.VN_CURDATE() + AND st.isChecked + ) stPrevious ON stPrevious.saleFk = io.saleFk + WHERE t.warehouseFk = vWarehouseFk + AND NOT s.isPicked + AND NOT io.reserved + AND stPrevious.saleFk IS NULL + AND io.shipped >= util.VN_CURDATE() + AND io.shipped < util.VN_CURDATE() + INTERVAL 1 DAY + ) sub + GROUP BY itemFk, `hours`, `minutes`; INSERT INTO tmp.itemShelvingRadar (itemFk) SELECT itemFk FROM tmp.itemOutTime - ON DUPLICATE KEY UPDATE dayEndVisible = dayEndVisible + quantity, - firstNegative = if (firstNegative < 0, firstNegative, firstNegative + quantity), - `hour` = ifnull(if (firstNegative > 0 , `hour`, hours),0), - `minute` = ifnull(if (firstNegative > 0, `minute`, minutes),0); + ON DUPLICATE KEY UPDATE dayEndVisible = dayEndVisible + quantity, + firstNegative = IF(firstNegative < 0, firstNegative, firstNegative + quantity), + `hour` = IFNULL(IF(firstNegative > 0 , `hour`, `hours`), 0), + `minute` = IFNULL(IF(firstNegative > 0, `minute`, `minutes`), 0); UPDATE tmp.itemShelvingRadar isr - JOIN (SELECT s.itemFk, sum(s.quantity) amount - FROM sale s - JOIN ticket t ON t.id = s.ticketFk - JOIN ticketLastState tls ON tls.ticketFk = t.id - WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE()) - AND tls.name = 'Prep Camara' - GROUP BY s.itemFk) sub ON sub.itemFk = isr.itemFk + JOIN ( + SELECT s.itemFk, SUM(s.quantity) amount + FROM sale s + JOIN ticket t ON t.id = s.ticketFk + JOIN ticketState ts ON ts.ticketFk = t.id + WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE()) + AND ts.code = 'COOLER_PREPARATION' + GROUP BY s.itemFk + ) sub ON sub.itemFk = isr.itemFk SET isr.dayEndVisible = dayEndVisible + sub.amount, firstNegative = firstNegative + sub.amount; From 9134e0ff653a33ab8d2b9c52c7ccd1a5904026a9 Mon Sep 17 00:00:00 2001 From: guillermo Date: Wed, 15 May 2024 14:05:35 +0200 Subject: [PATCH 16/17] feat: refs #7264 Minor change --- db/routines/vn/procedures/itemShelvingRadar.sql | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/db/routines/vn/procedures/itemShelvingRadar.sql b/db/routines/vn/procedures/itemShelvingRadar.sql index 6cebefefe..7875c4791 100644 --- a/db/routines/vn/procedures/itemShelvingRadar.sql +++ b/db/routines/vn/procedures/itemShelvingRadar.sql @@ -32,7 +32,7 @@ BEGIN CALL cache.available_refresh(vCalcAvailableFk, FALSE, vWarehouseFk, util.VN_CURDATE()); IF hasFatherSector THEN - CREATE OR REPLACE TEMPORARY TABLE tmp.itemShelvingRadar + CREATE OR REPLACE TEMPORARY TABLE tItemShelvingRadar (PRIMARY KEY (itemFk)) ENGINE = MEMORY SELECT * @@ -97,7 +97,7 @@ BEGIN SELECT ishr.*, CAST(visible - upstairs - downstairs AS DECIMAL(10, 0)) nicho, CAST(downstairs - IFNULL(notPickedYed, 0) AS DECIMAL(10, 0)) pendiente - FROM tmp.itemShelvingRadar ishr + FROM tItemShelvingRadar ishr JOIN item i ON i.id = ishr.itemFk LEFT JOIN ( SELECT s.itemFk, SUM(s.quantity) notPickedYed @@ -111,7 +111,7 @@ BEGIN ) sub ON sub.itemFk = ishr.itemFk ORDER BY i.typeFk, i.longName; ELSE - CREATE OR REPLACE TEMPORARY TABLE tmp.itemShelvingRadar + CREATE OR REPLACE TEMPORARY TABLE tItemShelvingRadar (PRIMARY KEY (itemFk)) ENGINE = MEMORY SELECT iss.itemFk, @@ -158,7 +158,7 @@ BEGIN IF(HOUR(t.shipped), HOUR(t.shipped), HOUR(z.`hour`)) `hours`, IF(MINUTE(t.shipped), MINUTE(t.shipped), MINUTE(z.`hour`)) `minutes` FROM itemTicketOut `io` - JOIN tmp.itemShelvingRadar isr ON isr.itemFk = io.itemFk + JOIN tItemShelvingRadar isr ON isr.itemFk = io.itemFk JOIN ticket t ON t.id= io.ticketFk JOIN ticketState ts ON ts.ticketFk = io.ticketFk JOIN `state` s ON s.id = ts.stateFk @@ -178,14 +178,14 @@ BEGIN ) sub GROUP BY itemFk, `hours`, `minutes`; - INSERT INTO tmp.itemShelvingRadar (itemFk) + INSERT INTO tItemShelvingRadar (itemFk) SELECT itemFk FROM tmp.itemOutTime ON DUPLICATE KEY UPDATE dayEndVisible = dayEndVisible + quantity, firstNegative = IF(firstNegative < 0, firstNegative, firstNegative + quantity), `hour` = IFNULL(IF(firstNegative > 0 , `hour`, `hours`), 0), `minute` = IFNULL(IF(firstNegative > 0, `minute`, `minutes`), 0); - UPDATE tmp.itemShelvingRadar isr + UPDATE tItemShelvingRadar isr JOIN ( SELECT s.itemFk, SUM(s.quantity) amount FROM sale s @@ -198,10 +198,10 @@ BEGIN SET isr.dayEndVisible = dayEndVisible + sub.amount, firstNegative = firstNegative + sub.amount; - SELECT * FROM tmp.itemShelvingRadar; + SELECT * FROM tItemShelvingRadar; END IF; - DROP TEMPORARY TABLE tmp.itemShelvingRadar; + DROP TEMPORARY TABLE tItemShelvingRadar; END$$ DELIMITER ; From 049e8931ab7109a6e00e7a59c2835378947dc5d9 Mon Sep 17 00:00:00 2001 From: guillermo Date: Wed, 15 May 2024 14:30:04 +0200 Subject: [PATCH 17/17] hotfix: Tmp fix item_getSimilar --- db/routines/vn/procedures/item_getSimilar.sql | 3 +++ 1 file changed, 3 insertions(+) diff --git a/db/routines/vn/procedures/item_getSimilar.sql b/db/routines/vn/procedures/item_getSimilar.sql index b0f3ca40e..762c25342 100644 --- a/db/routines/vn/procedures/item_getSimilar.sql +++ b/db/routines/vn/procedures/item_getSimilar.sql @@ -21,6 +21,9 @@ BEGIN CALL cache.available_refresh(vCalcFk, FALSE, vWarehouseFk, vDated); + -- Añadido temporalmente para que no se cuelgue la db + SET vShowType = TRUE; + WITH itemTags AS ( SELECT i.id, typeFk,