<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="">
    <query id="JdgHttCrackDetectionEt.getInfo" desc="获取探伤信息">
        <![CDATA[
SELECT A.TESTING_TYPE,
       A.TESTING_GRADE,
       B.TESTING_METHOD,
       A.PLINE_CODE,
       '合格' JUDGE_RESULT,
       (SELECT WM_CONCAT(C.STANDARD_NAME)
          FROM HTT_CRACK_DETECTION_STANDARD C
         WHERE C.STANDARD_ID = B.STANDARD_ID) STANDARD_NAME,
       B.LONGITUDINAL_EXTERNAL,
       B.LONGITUDINAL_INTERNAL,
       B.TRANSVERSE_EXTERNAL,
       B.TRANSVERSE_INTERNAL,
       B.WALL_THICKNESS,
       B.LAMINATION,
       A2.PROCESS_CODE,
       A2.PROCESS_DESC,
       A.TESTING_POSITION,
       B.REPORT_PATH,
       A.NOTCH_LENGTH,
       A.NOTCH_WIDTH,
       A.NOTCH_DEPTH,
       NVL(A.TESTING_NUM,0) TESTING_NUM,
       NVL(A.EWASTE_NUM,0)+NVL(A.EWASTE_NUM_ET,0)+NVL(A.DISQUALIFIED_NUM,0) EWASTE_NUM,
       NVL(A.EPASS_NUM,0)+NVL(A.EPASS_NUM_ET,0)+ NVL(A.FINAL_NUM,0) PASS_NUM,
       A.EWASTE_REASON,
       A.PENDING_NUM
  FROM HTT_CRACK_DETECTION_ET A
  LEFT JOIN COM_BASE_PROCESS A2
    ON A2.PROCESS_CODE = A.PROCESS_CODE, HTT_CRACK_DETECTION_PARA B
 WHERE A.JUDGE_STOVE_NO = {0}
   AND A.BATCH_NO = {1}
   AND A.PROCESS_CODE = {2}
   AND A.RESULT_NO = B.RESULT_NO
        ]]>
    </query>

    <query id="JdgHttCrackDetectionEt.getInfoByPline" desc="获取探伤信息">
        <![CDATA[
SELECT A.TESTING_TYPE,
       A.TESTING_GRADE,
       B.TESTING_METHOD,
       '合格' JUDGE_RESULT,
       (SELECT WM_CONCAT(C.STANDARD_NAME)
          FROM HTT_CRACK_DETECTION_STANDARD C
         WHERE C.STANDARD_ID = B.STANDARD_ID) STANDARD_NAME,
       B.LONGITUDINAL_EXTERNAL,
       B.LONGITUDINAL_INTERNAL,
       B.TRANSVERSE_EXTERNAL,
       B.TRANSVERSE_INTERNAL,
       B.WALL_THICKNESS,
       B.LAMINATION,
       A2.PROCESS_CODE,
       A2.PROCESS_DESC,
       A.TESTING_POSITION,
       B.REPORT_PATH,
       A.NOTCH_LENGTH,
       A.NOTCH_WIDTH,
       A.NOTCH_DEPTH,
       NVL(A.TESTING_NUM,0) TESTING_NUM,
       NVL(A.EWASTE_NUM,0)+NVL(A.EWASTE_NUM_ET,0)+NVL(A.DISQUALIFIED_NUM,0) EWASTE_NUM,
       NVL(A.EPASS_NUM,0)+NVL(A.EPASS_NUM_ET,0)+ NVL(A.FINAL_NUM,0) PASS_NUM,
       A.EWASTE_REASON,
       A.PENDING_NUM
  FROM HTT_CRACK_DETECTION_ET A
  LEFT JOIN COM_BASE_PROCESS A2
    ON A2.PROCESS_CODE = A.PROCESS_CODE, HTT_CRACK_DETECTION_PARA B
 WHERE A.JUDGE_STOVE_NO = {0}
   AND A.BATCH_NO = {1}
   AND A.PROCESS_CODE = {2}
   AND A.PLINE_CODE = {3}
   AND A.RESULT_NO = B.RESULT_NO
        ]]>
    </query>
    
    <query id="JdgHttCrackDetectionEt.getZgInfo" desc="获取轧管探伤信息">
        <![CDATA[
SELECT 'EMI' TESTING_TYPE,
       '合格' JUDGE_RESULT,
       A.INSPECTION_STANDARD STANDARD_NAME,
       A.NOTCH_LENGTH,
       A.NOTCH_WIDTH,
       A.NOTCH_DEPTH,
       A.LO_SURFACE TESTING_GRADE,
       DECODE(T.DETECT_RESULT_PATH,
              NULL,
              NULL,
              T.DETECT_RESULT_PATH || T.REPORT_NO || '.pdf') REPORT_PATH,
       A.LO_SURFACE LONGITUDINAL_EXTERNAL,
       A.LI_SURFACE LONGITUDINAL_INTERNAL,
       A.TO_SURFACE TRANSVERSE_EXTERNAL,
       A.TI_SURFACE TRANSVERSE_INTERNAL,
       DETECTION_NUM TESTING_NUM,
       SCRAP_NUM EWASTE_NUM,
       QUALIFIED_NUM PASS_NUM,
       SCRAP_REASON EWASTE_REASON,
       NULL PENDING_NUM,
       A.TESTING_POSITION
  FROM MIL_MT_RESULT A
  LEFT JOIN QCM_INSPECTION_REPORT T
    ON REGEXP_REPLACE(A.JUDGE_STOVE_NO, '-.*', '') = T.JUDGE_STOVE_NO
 WHERE REGEXP_REPLACE(A.JUDGE_STOVE_NO, '-.*', '') = {0}
UNION ALL
SELECT 'ET' TESTING_TYPE,
       '合格' JUDGE_RESULT,
       A.INSPECTION_STANDARD,
       A.NOTCH_LENGTH,
       A.NOTCH_WIDTH,
       A.NOTCH_DEPTH,
       A.ACCEPTANCE_GRADE TESTING_GRADE,
       T.DETECT_RESULT_PATH REPORT_PATH,
       NULL LONGITUDINAL_EXTERNAL,
       NULL LONGITUDINAL_INTERNAL,
       NULL TRANSVERSE_EXTERNAL,
       NULL TRANSVERSE_INTERNAL,
       DETECTION_NUM TESTING_NUM,
       SCRAP_NUM EWASTE_NUM,
       QUALIFIED_NUM PASS_NUM,
       SCRAP_REASON EWASTE_REASON,
       NULL PENDING_NUM,
       A.TESTING_POSITION
  FROM MIL_ET_RESULT A
  LEFT JOIN QCM_INSPECTION_REPORT T
    ON REGEXP_REPLACE(A.JUDGE_STOVE_NO, '-.*', '') = T.JUDGE_STOVE_NO
 WHERE REGEXP_REPLACE(A.JUDGE_STOVE_NO, '-.*', '') = {0}
UNION ALL
SELECT A.TESTING_TYPE,
       '合格' JUDGE_RESULT,
       NULL INSPECTION_STANDARD,
       NULL NOTCH_LENGTH,
       NULL NOTCH_WIDTH,
       NULL NOTCH_DEPTH,
       A.TESTING_GRADE,
       T.DETECT_RESULT_PATH REPORT_PATH,
       NULL LONGITUDINAL_EXTERNAL,
       NULL LONGITUDINAL_INTERNAL,
       NULL TRANSVERSE_EXTERNAL,
       NULL TRANSVERSE_INTERNAL,
       NULL TESTING_NUM,
       NULL EWASTE_NUM,
       NULL PASS_NUM,
       NULL EWASTE_REASON,
       NULL PENDING_NUM,
       null TESTING_POSITION
  FROM MIL_ENTRUSTED_BILL A
  LEFT JOIN QCM_INSPECTION_REPORT T
    ON REGEXP_REPLACE(A.JUDGE_STOVE_NO, '-.*', '') = T.JUDGE_STOVE_NO
 WHERE REGEXP_REPLACE(A.JUDGE_STOVE_NO, '-.*', '') = {0}
UNION ALL
SELECT T2.TESTING_TYPE,
       '合格' JUDGE_RESULT,
       NULL INSPECTION_STANDARD,
       T2.NOTCH_LENGTH,
       T2.NOTCH_WIDTH,
       T2.NOTCH_DEPTH,
       T2.TESTING_GRADE,
       T2.DETECT_RESULT_PATH REPORT_PATH,
       NULL LONGITUDINAL_EXTERNAL,
       NULL LONGITUDINAL_INTERNAL,
       NULL TRANSVERSE_EXTERNAL,
       NULL TRANSVERSE_INTERNAL,
       NULL TESTING_NUM,
       NULL EWASTE_NUM,
       NULL PASS_NUM,
       NULL EWASTE_REASON,
       NULL PENDING_NUM,
       null TESTING_POSITION
  FROM QCM_ZG_JUGDE_APPLY T2
 WHERE T2.JUDGE_STOVE_NO = {0}
   AND T2.PROCESS_CODE = 'D'
   AND T2.PLINE_CODE IN ('C065','C066','C098','C099')
UNION ALL
SELECT A.TESTING_TYPE,
       '合格' JUDGE_RESULT,
       TO_CHAR((SELECT WM_CONCAT(C.STANDARD_NAME)
                 FROM HTT_CRACK_DETECTION_STANDARD C
                WHERE C.STANDARD_ID = B.STANDARD_ID)) STANDARD_NAME,
       A.NOTCH_LENGTH,
       A.NOTCH_WIDTH,
       A.NOTCH_DEPTH,
       A.TESTING_GRADE,
       B.REPORT_PATH,
       B.LONGITUDINAL_EXTERNAL,
       B.LONGITUDINAL_INTERNAL,
       B.TRANSVERSE_EXTERNAL,
       B.TRANSVERSE_INTERNAL,
       NVL(A.TESTING_NUM,0) TESTING_NUM,
       NVL(A.EWASTE_NUM,0)+NVL(A.EWASTE_NUM_ET,0)+NVL(A.DISQUALIFIED_NUM,0) EWASTE_NUM,
       NVL(A.EPASS_NUM,0)+NVL(A.EPASS_NUM_ET,0)+ NVL(A.FINAL_NUM,0) PASS_NUM,
       A.EWASTE_REASON,
       A.PENDING_NUM,
       A.TESTING_POSITION
  FROM HTT_CRACK_DETECTION_ET A
  LEFT JOIN COM_BASE_PROCESS A2
    ON A2.PROCESS_CODE = A.PROCESS_CODE, HTT_CRACK_DETECTION_PARA B
 WHERE A.JUDGE_STOVE_NO = {0}
   AND A.BATCH_NO = {1}
   AND A.PROCESS_CODE = 'D'
   AND A.RESULT_NO = B.RESULT_NO
        ]]>
    </query>

    <query id="JdgHttCrackDetectionEt.getDbkInfo" desc="获取镦拔扩探伤信息">
        <![CDATA[
  SELECT DISTINCT
          T.TESTING_TYPE,
          T.TESTING_GRADE,
          NULL METHOD,
          '合格' JUDGE_RESULT,
          NULL STANDARD_NAME,
          NULL LONGITUDINAL_EXTERNAL,
          NULL LONGITUDINAL_INTERNAL,
          NULL TRANSVERSE_EXTERNAL,
          NULL TRANSVERSE_INTERNAL,
          NULL WALL_THICKNESS,
          NULL LAMINATION,
          NULL PROCESS_CODE,
          NULL PROCESS_DESC,
          NULL TESTING_POSITION,
          NULL REPORT_PATH,
          T.NOTCH_LENGTH,
          T.NOTCH_WIDTH,
          T.NOTCH_DEPTH
     FROM QCM_ZG_JUGDE_APPLY T
    WHERE T.JUDGE_STOVE_NO = {0}
      AND T.BATCH_NO = {1}
      AND T.PROCESS_CODE = {2}
      AND T.IS_FLAG = '0'
      AND T.IS_ALL_SCRAP = '0'
        ]]>
    </query>

    <query id="JdgHttCrackDetectionEt.getZbsDetect" desc="获取质保书探伤信息">
        <![CDATA[
SELECT LISTAGG(TESTING_GRADE, ',') WITHIN GROUP(ORDER BY TESTING_GRADE) OVER(PARTITION BY '') TESTING_GRADE,
       LISTAGG(TESTING_TYPE, ',') WITHIN GROUP(ORDER BY TESTING_GRADE) OVER(PARTITION BY '') TESTING_TYPE
  FROM (SELECT DISTINCT T.TESTING_GRADE, T.TESTING_TYPE
          FROM HTT_CRACK_DETECTION_ET T
         WHERE T.JUDGE_STOVE_NO = {0}
           AND T.BATCH_NO = {1}
           AND T.PROCESS_CODE = {2})
        ]]>
    </query>
</queryMap>