1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
select
case when TO_CHAR(SYSDATE, 'HH24:MI:SS') > '13:00:00' then
select wo.num_wo,
wi.num_wo_instruction as num_bon,
r.name as operateur,
d.name as departement,
to_char(w.in_date,'DD/MM/YYYY') || ' '|| TO_CHAR(w.in_time, 'HH24:MI:SS') as date_badgage,
r2.name as poste
from topmes.wip_pointing w
inner join topmes.wo_instruction wi
on w.id_wo_instruction = wi.id_wo_instruction
inner join toppdm.resources r
on w.id_labor_resource = r.id_resource
inner join toppdm.resource_tree_item rt
on r.id_resource = rt.id_resource
inner join topsys.department d
on rt.id_parent_origin = d.id_department
left outer join toppdm.resources r2
on w.id_mach_resource = r2.id_resource
inner join topmes.wo wo
on wi.id_wo = wo.id_wo
where ((to_char(w.in_time,'HH24:MI:SS') < '13:00:00' and to_char(w.in_date,'DD/MM/YY') = to_char(sysdate,'DD/MM/YY'))
or (to_char(w.in_date,'YYYYMMDD') < to_char(sysdate,'YYYYMMDD')))
else
select wo.num_wo,
wi.num_wo_instruction as num_bon,
r.name as operateur,
d.name as departement,
to_char(w.in_date,'DD/MM/YYYY') || ' '|| TO_CHAR(w.in_time, 'HH24:MI:SS') as date_badgage,
r2.name as poste
from topmes.wip_pointing w
inner join topmes.wo_instruction wi
on w.id_wo_instruction = wi.id_wo_instruction
inner join toppdm.resources r
on w.id_labor_resource = r.id_resource
inner join toppdm.resource_tree_item rt
on r.id_resource = rt.id_resource
inner join topsys.department d
on rt.id_parent_origin = d.id_department
left outer join toppdm.resources r2
on w.id_mach_resource = r2.id_resource
inner join topmes.wo wo
on wi.id_wo = wo.id_wo
where to_char(w.in_date,'YYYYMMDD') < to_char(sysdate,'YYYYMMDD')
end |
Partager