select t1.smp_no, t1.specimen_no, t1.heat_no, t1.batch_no, t1.inspection_lot, t1.freq_code, t1.freq_name, t1.material_no, t1.smp_type_code, t1.smp_type_name, t1.consign_no, t1.consign_no_seq, t1.test_qty, t1.smp_qty, t1.smp_location, t1.board_no, t1.quote_consign_no, t1.old_consign_no, t1.pline_code, t1.pline_name, t1.status, t1.validflag, t1.source, t1.guid, t1.send_id, t1.send_name, to_char(t1.send_time,'yyyy-MM-dd hh24:mi:ss') send_time, t1.chem_item, t1.product_cnt, to_char(t1.create_time,'yyyy-MM-dd hh24:mi:ss') create_time, t1.smp_location_code, t1.memo, t2.psc, t2.psc_desc, t2.smp_catg, t2.cert_inst_code, t2.cert_inst_name, t2.grade_code, t2.grade_name, t2.memo ordermemo, t1.send_flag, t1.gyh from jhy_weito_m t1, qcm_jhy_sample_consign_m t2 where t1.smp_no = t2.smp_no(+) and exists (select 1 from (select '0' send_flag from dual union select '1' send_flag from dual) tt where tt.send_flag = t1.send_flag) and t1.pline_name = nvl(?, t1.pline_name) and to_char(t1.create_time, 'yyyyMMddhh24miss') between nvl(?, t1.create_time) and nvl(?, t1.create_time) and t1.batch_no like ?||'%' order by t1.gyh desc select phy_code_l qlty_cd_2, phy_code_s qlty_cd_3, phy_name_s qlty_cd_3_nm, smp_no, --specimen_no, seq from (select t.phy_code_l, t.phy_code_s, phy_name_s, row_number() over(partition by t.phy_name_s order by t.seq) xh, t.smp_no, t.specimen_no, t.seq from qcm_jhy_sample_consign_d_item t where t.smp_no = ? union select 'HA' phy_code_l, 'ER' phy_code_s, '面积' phy_name_s, 1 xh, t.smp_no, t.specimen_no, 0 seq from tbb10_qlty_qcmval t where t.smp_no = ? and t.qlty_cd_2 = 'HA' group by t.smp_no, t.specimen_no) where xh = 1 order by seq select distinct t.* from (select nvl(t3.qlty_ope_cd, t1.qlty_ope_cd) qlty_ope_cd, nvl(t3.qlty_dis_seq, 1) qlty_dis_seq, nvl(t3.qlty_ope_cfnm, t1.qlty_ope_cfnm) qlty_ope_cfnm from tbb10_qlty_qcmval t1, tbb10_qlty_qcm t3 where t1.qlty_cd_2 = t3.line_range(+) and t1.smp_cut_loc = t3.qlty_cd_2(+) and t1.smp_no = ? and t1.qlty_cd_after = ? order by t1.smp_no_type, t3.qlty_dis_seq) t order by t.qlty_dis_seq with t1 as (select t3.smp_no smp_no1, t3.specimen_no specimen_no1, t3.smp_no_type smp_no_type1, t3.smp_cut_loc smp_cut_loc1 {1} from tbb10_qlty_qcmval t3 where t3.smp_no = ? group by t3.smp_no, t3.specimen_no, t3.smp_no_type, t3.smp_cut_loc) select t.smp_cut_loc, t.qlty_cd_2, t.qlty_ope_cfnm, decode(t.qlty_cd_after, 'ER', '面积', t2.phy_name_s || ' ' || t2.item_name_t || ' ' || t2.item_name_d || ' ' || t2.item_name_s) qlty_cd_cfnm, t.qlty_val, t.qlty_cd_after, t.smp_no, t.specimen_no, t.smp_no_type, t.qlty_cd, t4.material_no, t1.* from tbb10_qlty_qcmval t, t1, qcm_jhy_sample_consign_d_item t2,qcm_jhy_sample_consign_d t4 where t.smp_no = t1.smp_no1(+) and t.specimen_no = t1.specimen_no1(+) and t.smp_no_type = t1.smp_no_type1(+) and nvl(t.smp_cut_loc, '0') = nvl(t1.smp_cut_loc1(+), '0') and t.smp_no = t2.smp_no(+) and t.specimen_no = t2.specimen_no(+) and t.qlty_cd = t2.seq(+) and t.smp_no = t4.smp_no(+) and t.specimen_no = t4.specimen_no(+) and t.qlty_cd_2 = ? and t.qlty_cd_after = ? and t.smp_no = ? order by t.smp_no, t.specimen_no, t.smp_no_type, t.qlty_ope_cd select t1.qlty_ope_cfnm, t1.qlty_ope_cd, t1.smp_cut_loc, decode(nvl(t1.qlty_type, '1'), '2', t3.comp_cal2, t3.comp_cal) comp_cal, decode(nvl(t1.qlty_type, '1'), '2', t3.qlty_dis_len2, t3.qlty_dis_len) qlty_dis_len, decode(nvl(t1.qlty_type, '1'), '2', t3.crct_reg2, t3.crct_reg) crct_reg, t3.qlty_dis_seq, t1.qlty_val, t1.qlty_val1, t1.qlty_val2, t1.qlty_val3, t3.edit_tp from tbb10_qlty_qcmval t1, tbb10_qlty_qcm t3 where t1.smp_cut_loc = t3.qlty_cd_2(+) and t1.qlty_ope_cd = t3.qlty_ope_cd(+) and t1.smp_no = ? and t1.specimen_no = ? and t1.smp_no_type = ? and nvl(t1.smp_cut_loc, '0') = ? and t1.qlty_cd_2 = ? and t1.qlty_ope_cd in (select t.qlty_ope_cd from tbb10_qlty_qcm t where instr(t.qlty_ope_grp, ?) > 0) order by t3.qlty_dis_seq select t1.qlty_ope_cd, t1.qlty_val, t1.qlty_val1, t1.qlty_val2, t1.qlty_val3 from tbb10_qlty_qcmval t1, tbb10_qlty_qcm t3 where t1.smp_cut_loc = t3.qlty_cd_2(+) and t1.qlty_ope_cd = t3.qlty_ope_cd(+) and t1.smp_no = ? and t1.specimen_no = ? and t1.smp_no_type = ? select t1.qlty_ope_cfnm, t1.qlty_ope_cd, t1.smp_cut_loc, decode(nvl(t1.qlty_type, '1'), '2', t3.comp_cal2, t3.comp_cal) comp_cal, decode(nvl(t1.qlty_type, '1'), '2', t3.qlty_dis_len2, t3.qlty_dis_len) qlty_dis_len, decode(nvl(t1.qlty_type, '1'), '2', t3.crct_reg2, t3.crct_reg) crct_reg, t3.qlty_dis_seq, t1.qlty_val, t1.qlty_val1, t1.qlty_val2, t1.qlty_val3, t3.edit_tp from tbb10_qlty_qcmval t1, tbb10_qlty_qcm t3 where t1.smp_cut_loc = t3.qlty_cd_2(+) and t1.qlty_ope_cd = t3.qlty_ope_cd(+) and t1.smp_no = ? and t1.specimen_no = ? and t1.smp_no_type = ? and nvl(t1.smp_cut_loc, '0') = ? and t1.qlty_cd_2 = ? and t1.qlty_ope_cd = ? select t1.qlty_ope_cd, t1.qlty_val, t1.qlty_val1, t1.qlty_val2, t1.qlty_val3 from tbb10_qlty_qcmval t1, tbb10_qlty_qcm t3 where t1.smp_cut_loc = t3.qlty_cd_2(+) and t1.qlty_ope_cd = t3.qlty_ope_cd(+) and t1.smp_no = ? and t1.specimen_no = ? and t1.smp_no_type = ? select t1.specimen_no, t1.seq, t1.smp_no, t1.phy_name_l, t1.phy_code_l, t1.phy_code_m, t1.phy_name_m, t1.phy_code_s, t1.phy_name_s, t1.item_code_d, t1.item_name_d, t1.item_code_t, t1.item_name_t, t1.item_code_s, t1.item_name_s, t1.item_code_l, t1.item_desc_l, t2.qlty_val from qcm_jhy_sample_consign_d_item t1, tbb10_qlty_qcmval t2 where t1.smp_no = t2.smp_no(+) and t1.specimen_no = t2.specimen_no(+) and t1.seq = t2.qlty_cd(+) and t1.smp_no = ? order by t1.smp_no, t1.specimen_no, t1.seq select phy_name_s, item_name_d, create_name, phy_name_m, phy_name_l, item_code_t, item_code_s, group_seq, to_char(create_time, 'yyyy-MM-dd hh24:mi:ss') create_time, item_code_l, '0' defect_flag, memo, phy_code_m, phy_code_l, item_desc_l, item_code_d, phy_code_s, sys_guid() guid, phy_unit unti, --max_val, item_name_t, item_name_s, test_qty, t2.val1, t2.val2, t2.val3, t2.val4, t2.val5, t2.val6, t2.val7, t2.val8, t2.val9, --min_val, t1.seq --, --avg_val from qcm_jhy_sample_consign_d_item t1, (select t1.smp_no, t1.specimen_no, t1.seq, max(t1.val1) val1, max(t1.val2) val2, max(t1.val3) val3, max(t1.val4) val4, max(t1.val5) val5, max(t1.val6) val6, max(t1.val7) val7, max(t1.val8) val8, max(t1.val9) val9 from (with t2 as (select t.smp_no, t.specimen_no, t.qlty_cd, t.qlty_val, row_number() over(partition by t.smp_no, t.specimen_no, t.qlty_cd order by t.qlty_ope_cd) xh from tbb10_qlty_qcmval t where t.specimen_no = ?) select t1.smp_no, t1.specimen_no, t1.seq, decode(t2.xh, 1, t2.qlty_val, '') val1, decode(t2.xh, 2, t2.qlty_val, '') val2, decode(t2.xh, 3, t2.qlty_val, '') val3, decode(t2.xh, 4, t2.qlty_val, '') val4, decode(t2.xh, 5, t2.qlty_val, '') val5, decode(t2.xh, 6, t2.qlty_val, '') val6, decode(t2.xh, 7, t2.qlty_val, '') val7, decode(t2.xh, 8, t2.qlty_val, '') val8, decode(t2.xh, 9, t2.qlty_val, '') val9 from qcm_jhy_sample_consign_d_item t1, t2 where t1.smp_no = t2.smp_no(+) and t1.specimen_no = t2.specimen_no(+) and t1.seq = t2.qlty_cd(+) and t1.specimen_no = ?) t1 group by t1.smp_no, t1.specimen_no, t1.seq ) t2 where t1.smp_no = t2.smp_no(+) and t1.specimen_no = t2.specimen_no(+) and t1.seq = t2.seq(+) and t1.specimen_no = ? order by t1.seq with t3 as (select t3.smp_no, t3.specimen_no, t3.smp_no_type, t3.smp_cut_loc, max(decode('a', t3.qlty_ope_cd, t3.qlty_val1, null)) "a01", max(decode('b', t3.qlty_ope_cd, t3.qlty_val1, null)) "b01", max(decode('a', t3.qlty_ope_cd, t3.qlty_val2, null)) "a02", max(decode('b', t3.qlty_ope_cd, t3.qlty_val2, null)) "b02", max(decode('a', t3.qlty_ope_cd, t3.qlty_val3, null)) "a03", max(decode('b', t3.qlty_ope_cd, t3.qlty_val3, null)) "b03", max(decode('Fe', t3.qlty_ope_cd, t3.qlty_val, null)) "FeL/FeH", max(decode('Fm', t3.qlty_ope_cd, t3.qlty_val, null)) "Fm", max(decode('Lo', t3.qlty_ope_cd, t3.qlty_val, null)) "Lo", max(decode('Lu', t3.qlty_ope_cd, t3.qlty_val, null)) "Lu" from tbb10_qlty_qcmval t3 where instr(? , t3.specimen_no) > 0 and t3.qlty_cd_2 = 'HA' group by t3.smp_no, t3.specimen_no, t3.smp_no_type, t3.smp_cut_loc), t4 as (select t.specimen_no, t.item_code_s from qcm_jhy_sample_consign_d_item t where instr(? , t.specimen_no) > 0 and t.phy_code_l = 'HA' group by t.specimen_no, t.item_code_s) select t.gyh, t2.grade_name, t.batch_no, t.material_thk, t3.*, t4.item_code_s from jhy_weito_m t, qcm_jhy_sample_consign_m t2,t3, t4 where t.smp_no = t2.smp_no(+) and t.specimen_no = t3.specimen_no(+) and t.specimen_no = t4.specimen_no(+) and instr(? , t.specimen_no) > 0 and t4.item_code_s = ? with t3 as (select t3.smp_no, t3.specimen_no, t3.smp_no_type, t3.smp_cut_loc, t2.item_name_d, t2.item_name_t, max(decode('A1', t3.qlty_ope_cd, t3.qlty_val, null)) "J1", max(decode('A2', t3.qlty_ope_cd, t3.qlty_val, null)) "J2", max(decode('A3', t3.qlty_ope_cd, t3.qlty_val, null)) "J3" from tbb10_qlty_qcmval t3, qcm_jhy_sample_consign_d_item t2 where t3.smp_no = t2.smp_no(+) and t3.specimen_no = t2.specimen_no(+) and t3.qlty_cd = t2.seq(+) and instr(? , t3.specimen_no) > 0 and t3.qlty_cd_2 = 'HC' group by t3.smp_no, t3.specimen_no, t3.smp_no_type, t3.smp_cut_loc, t2.item_name_d, t2.item_name_t) select t.gyh, t2.grade_name, t.batch_no, t.material_thk, t3.* from jhy_weito_m t, qcm_jhy_sample_consign_m t2, t3 where t.smp_no = t2.smp_no(+) and t.specimen_no = t3.specimen_no(+) and instr(? , t.specimen_no) > 0 {call jhy02.save_work_val1(?,?,?,?,?,?,?,?,?,?,?,?,?)} {call jhy02.save_work_val2(?,?,?,?,?,?,?,?,?,?,?,?,?)} {call jhy02.save_work_val3(?,?,?,?,?,?,?,?,?,?,?,?,?)} update jhy_weito_m t set t.send_flag = '1' where t.specimen_no = ?