2023-12-21 07:33:50 +00:00
|
|
|
CREATE SCHEMA IF NOT EXISTS `vn2008`;
|
|
|
|
USE `vn`;
|
|
|
|
|
2023-11-30 13:25:00 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
|
|
|
SQL SECURITY DEFINER
|
2023-12-21 07:33:50 +00:00
|
|
|
VIEW `ticketState`
|
2023-11-30 13:25:00 +00:00
|
|
|
AS SELECT `tt`.`created` AS `updated`,
|
|
|
|
`tt`.`stateFk` AS `stateFk`,
|
2023-12-19 08:43:09 +00:00
|
|
|
`tt`.`userFk` AS `workerFk`,
|
2023-11-30 13:25:00 +00:00
|
|
|
`tls`.`ticketFk` AS `ticketFk`,
|
|
|
|
`s`.`id` AS `state`,
|
|
|
|
`s`.`order` AS `productionOrder`,
|
|
|
|
`s`.`alertLevel` AS `alertLevel`,
|
|
|
|
`s`.`code` AS `code`,
|
|
|
|
`tls`.`ticketFk` AS `ticket`,
|
|
|
|
`tt`.`userFk` AS `worker`,
|
|
|
|
`s`.`isPreviousPreparable` AS `isPreviousPreparable`,
|
|
|
|
`s`.`isPicked` AS `isPicked`
|
|
|
|
FROM (
|
|
|
|
(
|
2023-12-21 07:33:50 +00:00
|
|
|
`ticketLastState` `tls`
|
|
|
|
JOIN `ticketTracking` `tt` ON(`tt`.`id` = `tls`.`ticketTrackingFk`)
|
2023-11-30 13:25:00 +00:00
|
|
|
)
|
2023-12-21 07:33:50 +00:00
|
|
|
JOIN `state` `s` ON(`s`.`id` = `tt`.`stateFk`)
|
2023-11-30 13:25:00 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
|
|
|
SQL SECURITY DEFINER
|
|
|
|
VIEW `vn2008`.`v_inter`
|
|
|
|
AS SELECT `tt`.`id` AS `inter_id`,
|
|
|
|
`tt`.`stateFk` AS `state_id`,
|
|
|
|
`tt`.`notes` AS `nota`,
|
|
|
|
`tt`.`created` AS `odbc_date`,
|
|
|
|
`tt`.`ticketFk` AS `Id_Ticket`,
|
|
|
|
`tt`.`userFk` AS `Id_Trabajador`,
|
|
|
|
`tt`.`supervisorFk` AS `Id_supervisor`
|
|
|
|
FROM `vn`.`ticketTracking` `tt`;
|
2023-12-13 11:04:07 +00:00
|
|
|
|
2023-12-21 07:33:50 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
|
|
|
SQL SECURITY DEFINER
|
|
|
|
VIEW `ticketStateToday`
|
|
|
|
AS SELECT
|
2023-12-13 11:04:07 +00:00
|
|
|
`ts`.`ticket` AS `ticket`,
|
|
|
|
`ts`.`state` AS `state`,
|
|
|
|
`ts`.`productionOrder` AS `productionOrder`,
|
|
|
|
`ts`.`alertLevel` AS `alertLevel`,
|
2023-12-19 11:58:20 +00:00
|
|
|
`ts`.`worker` AS `worker`,
|
2023-12-13 11:04:07 +00:00
|
|
|
`ts`.`code` AS `code`,
|
|
|
|
`ts`.`updated` AS `updated`,
|
|
|
|
`ts`.`isPicked` AS `isPicked`
|
|
|
|
FROM
|
|
|
|
(`ticketState` `ts`
|
|
|
|
JOIN `ticket` `t` ON
|
|
|
|
(`t`.`id` = `ts`.`ticket`))
|
|
|
|
WHERE
|
|
|
|
`t`.`shipped` BETWEEN `util`.`VN_CURDATE`() AND `MIDNIGHT`(`util`.`VN_CURDATE`());
|