21 lines
644 B
MySQL
21 lines
644 B
MySQL
|
CREATE OR REPLACE DEFINER=`juan`@`%`
|
||
|
SQL SECURITY DEFINER
|
||
|
VIEW `srt`.`expeditionVolume`
|
||
|
AS SELECT `bs`.`dayMinute` AS `dayMinute`,
|
||
|
`bs`.`eta` AS `ETD`,
|
||
|
COUNT(0) AS `cajas`,
|
||
|
`bs`.`eta` + INTERVAL - `c`.`minutesBeforeTruckDeparture` MINUTE < `util`.`VN_NOW`()
|
||
|
OR COUNT(0) >= `c`.`minBoxesToUnloading` AS `isReady`,
|
||
|
`bs`.`truck` AS `truck`,
|
||
|
`bs`.`zonaTicket` AS `zonaTicket`,
|
||
|
`bs`.`bufferTruck` AS `bufferTruck`
|
||
|
FROM (
|
||
|
`srt`.`bufferStock` `bs`
|
||
|
JOIN `srt`.`config` `c`
|
||
|
)
|
||
|
WHERE `bs`.`expeditionState` = 'STORED'
|
||
|
AND `bs`.`isActive` <> 0
|
||
|
AND `bs`.`hasWorkerWaiting` = 0
|
||
|
AND `bs`.`typeName` = 'ACCUMULATION'
|
||
|
GROUP BY `bs`.`dayMinute`
|