4270-route.create #1023

Merged
joan merged 13 commits from 4270-route.create into dev 2022-08-03 07:09:11 +00:00
1 changed files with 10 additions and 0 deletions
Showing only changes of commit d9a12fd203 - Show all commits

View File

@ -0,0 +1,10 @@
UPDATE `vn`.`route` r
JOIN(SELECT r.id, wl.workcenterFk
FROM `vn`.`route` r
JOIN `vn`.`routeLog` rl ON rl.originFk = r.id
JOIN `vn`.`workerLabour` wl ON wl.workerFk = rl.userFk
AND r.created BETWEEN wl.started AND IFNULL(wl.ended, r.created)
WHERE r.created BETWEEN '2021-12-01' AND CURDATE()
AND rl.action = 'insert'
)sub ON sub.id = r.id
SET r.commissionWorkCenterFk = sub.workcenterFk;