1、代码 (与本内容相关的代码:7~36)
1 select so.sale_order_no as sale_order_no, 2 (SELECT company_name from CUSTOMER where company_code = so.CUSTOMER_NO) as CUSTOMER_NAME, 3 so.out_order_no as out_order_no, 4 so.required_date, 5 (select sysdate from dual) as system_date, 6 so.quality_note as quality_note, 7 (select ‘同意‘ from dual WHERE substr(2,1,1) < substr(wf_node_code,1,1) AND so.pro_type = ‘01‘) as audit_opinion1, -- substr(2,1,1),从2开始,而不是从1开始;是因为审核到2节点了,但,还没审核通过。(以下7~36行代码 相同) 8 (select ‘同意‘ from dual WHERE SUBSTR(3,1,1) < SUBSTR(wf_node_code,1,1) AND so.pro_type = ‘01‘) as audit_opinion2, 9 (select ‘同意‘ from dual WHERE SUBSTR(4,1,1) < SUBSTR(wf_node_code,1,1) AND so.pro_type = ‘01‘) as audit_opinion3, 10 (select ‘同意‘ from dual WHERE SUBSTR(5,1,1) < SUBSTR(wf_node_code,1,1) AND so.pro_type = ‘01‘) as audit_opinion4, 11 (select ‘同意‘ from dual WHERE SUBSTR(6,1,1) < SUBSTR(wf_node_code,1,1) AND so.pro_type = ‘01‘) as audit_opinion5, 12 (select ‘同意‘ from dual WHERE SUBSTR(7,1,1) < SUBSTR(wf_node_code,1,1) AND so.pro_type = ‘01‘) as audit_opinion6, 13 (SELECT p.person_name FROM personnel p WHERE p.person_code = 14 (SELECT distinct au.person_code FROM APPLICATION_USERS au WHERE au.username = 15 (SELECT distinct w.role_code FROM Work_Flow_Role w WHERE w.wf_code = ‘000180‘ 16 AND SUBSTR(2,1,1) < SUBSTR(so.wf_node_code,1,1) AND w.node_code = DECODE(pro_type,‘01‘,22,‘03‘,2,‘04‘,23) AND w.role_code <> ‘test2‘))) as signature1, 17 (SELECT p.person_name FROM personnel p WHERE p.person_code = 18 (SELECT distinct au.person_code FROM APPLICATION_USERS au WHERE au.username = 19 (SELECT distinct w.role_code FROM Work_Flow_Role w WHERE w.wf_code = ‘000180‘ 20 AND SUBSTR(3,1,1) < SUBSTR(so.wf_node_code,1,1) AND w.node_code = DECODE(pro_type,‘01‘,3) AND w.role_code <> ‘test2‘))) as signature2, 21 (SELECT p.person_name FROM personnel p WHERE p.person_code = 22 (SELECT distinct au.person_code FROM APPLICATION_USERS au WHERE au.username = 23 (SELECT distinct w.role_code FROM Work_Flow_Role w WHERE w.wf_code = ‘000180‘ 24 AND SUBSTR(4,1,1) < SUBSTR(so.wf_node_code,1,1) AND w.node_code = DECODE(pro_type,‘01‘,41) AND w.role_code <> ‘test2‘))) as signature3, 25 (SELECT p.person_name FROM personnel p WHERE p.person_code = 26 (SELECT distinct au.person_code FROM APPLICATION_USERS au WHERE au.username = 27 (SELECT distinct w.role_code FROM Work_Flow_Role w WHERE w.wf_code = ‘000180‘ 28 AND SUBSTR(5,1,1) < SUBSTR(so.wf_node_code,1,1) AND w.node_code = DECODE(pro_type,‘01‘,5) AND w.role_code <> ‘test2‘))) as signature4, 29 (SELECT p.person_name FROM personnel p WHERE p.person_code = 30 (SELECT distinct au.person_code FROM APPLICATION_USERS au WHERE au.username = 31 (SELECT distinct w.role_code FROM Work_Flow_Role w WHERE w.wf_code = ‘000180‘ 32 AND SUBSTR(6,1,1) < SUBSTR(so.wf_node_code,1,1) AND w.node_code = DECODE(pro_type,‘01‘,6) AND w.role_code <> ‘test2‘))) as signature5, 33 (SELECT p.person_name FROM personnel p WHERE p.person_code = 34 (SELECT distinct au.person_code FROM APPLICATION_USERS au WHERE au.username = 35 (SELECT distinct w.role_code FROM Work_Flow_Role w WHERE w.wf_code = ‘000180‘ 36 AND SUBSTR(7,1,1) < SUBSTR(so.wf_node_code,1,1) AND w.node_code = DECODE(pro_type,‘01‘,7) AND w.role_code <> ‘test2‘))) as signature6 37 38 from sale_order so 39 where so.sale_order_no = $P{P_SALE_ORDER_NO} -- $P{P_SALE_ORDER_NO} :需要传入的参数(单号)
2、图示
最终效果图
小结:只要是对应的部门审核通过了,那么“审核意见”和“签名/时间”这两栏 要同时显示;没有审核通过的部门,都留空白。