<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc = "环形加热炉">
<query id = "FrmReheatFurnace.queryMinResult" desc = "查询">
<![CDATA[
SELECT AA.JUDGE_STOVE_NO,
       AA.LOT_NO,
       AA.PLINE_CODE,
       AA.PLINE_NAME,
       AA.ACTUAL_LENGTH_OF_WASTE_PIPE,
       AA.COL_SHIFT,
       AA.COL_GROUP,
       AA.STEELNAME,
       AA.GRADENAME,
       AA.PIPE_SECTION,
       AA.PROCESS_ROUTE,
       AA.TRANSFER_RHYTHM,
       AA.STEPPING_RHYTHM,
       AA.IN_FUR_TIME,
       AA.OUT_FUR_TIME,
       AA.FIRST_IN_TEMP,
       AA.LAST_IN_TEMP,
       AA.FIRST_OUT_TEMP,
       AA.LAST_OUT_TEMP,
       AA.SET_FUR_TEMP,
       AA.OUT_FUR_NUM,
       AA.SCRAP_REASON,
       AA.SCRAP_NUM,
       AA.OUT_REFUR_TIME,
       AA.COL_USER
  FROM (SELECT REGEXP_REPLACE(T.JUDGE_STOVE_NO, '-.*', '') JUDGE_STOVE_NO,
               T.LOT_NO,
               T.PLINE_CODE,
               (SELECT B.PLINE_NAME
                  FROM COM_BASE_PLINE B
                 WHERE B.PLINE_CODE = T.PLINE_CODE) PLINE_NAME,
               DECODE(T2.COL_SHIFT,
                      1,
                      '早班',
                      2,
                      '中班',
                      3,
                      '夜班',
                      0,
                      '常白班') COL_SHIFT,
               DECODE(T2.COL_GROUP, 1, '甲', 2, '乙', 3, '丙', 4, '丁') COL_GROUP,
               T1.STEELNAME,
               T1.GRADENAME,
               T1.PIPE_SECTION,
               T.ACTUAL_LENGTH_OF_WASTE_PIPE,
               DECODE(T.PROCESS_ROUTE,
                      '0',
                      '旁通',
                      '1',
                      '快速入炉',
                      '2',
                      '在线常化') PROCESS_ROUTE,
               T.TRANSFER_RHYTHM,
               T.STEPPING_RHYTHM,
               TO_CHAR(T.IN_FUR_TIME, 'HH24:MI') IN_FUR_TIME,
               TO_CHAR(T.OUT_FUR_TIME, 'HH24:MI') OUT_FUR_TIME,
               T.FIRST_IN_TEMP,
               T.LAST_IN_TEMP,
               T.FIRST_OUT_TEMP,
               T.LAST_OUT_TEMP,
               T.SET_FUR_TEMP,
               T.SCRAP_REASON,
                 (SELECT NVL(COUNT(*), 0)
                  FROM MIL_REFUR_RACK B
                 WHERE B.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
                   AND B.RESULT_NO = T.RESULT_NO
                   AND B.COL_SHIFT=T2.COL_SHIFT
                   AND B.COL_GROUP=T2.COL_GROUP
                   AND B.STATUS = '1') SCRAP_NUM,
               (SELECT NVL(COUNT(*), 0)
                  FROM MIL_REFUR_RACK B
                 WHERE B.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
                   AND B.RESULT_NO = T.RESULT_NO
                   AND B.COL_SHIFT=T2.COL_SHIFT
                   AND B.COL_GROUP=T2.COL_GROUP
                   AND B.STATUS = '0') OUT_FUR_NUM,
               TO_CHAR(T2.OUT_REFUR_TIME,'YYYY-MM-DD HH24:MI:SS') OUT_REFUR_TIME,
               T2.COL_USER
          FROM MIL_REFUR_RESULT T, MIL_PLAN T1, MIL_REFUR_RACK T2
         WHERE 1 = 1
           AND T.JUDGE_STOVE_NO = T1.JUDGE_STOVE_NO
           AND T2.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
           AND T2.RESULT_NO = T.RESULT_NO
           AND T2.JUDGE_STOVE_NO = T1.JUDGE_STOVE_NO
           AND T2.RESULT_NO = T1.ID
           --AND T2.MAT_NO IS NOT NULL
           AND T2.OUT_REFUR_TIME BETWEEN TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS') AND
               TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS')
           AND T2.COL_SHIFT LIKE '%' || ? || '%'
           AND T2.COL_GROUP LIKE '%' || ? || '%'
           AND T2.JUDGE_STOVE_NO LIKE '%' || ? || '%'
           #something#
         GROUP BY T.JUDGE_STOVE_NO,
                  T.RESULT_NO,
                  T.LOT_NO,
                  T.ACTUAL_LENGTH_OF_WASTE_PIPE,
                  T.PLINE_CODE,
                  T2.COL_SHIFT,
                  T2.COL_GROUP,
                  T1.STEELNAME,
                  T1.GRADENAME,
                  T1.PIPE_SECTION,
                  T.PROCESS_ROUTE,
                  T.TRANSFER_RHYTHM,
                  T.STEPPING_RHYTHM,
                  T.IN_FUR_TIME,
                  T.OUT_FUR_TIME,
                  T.FIRST_IN_TEMP,
                  T.LAST_IN_TEMP,
                  T.FIRST_OUT_TEMP,
                  T.LAST_OUT_TEMP,
                  T.SET_FUR_TEMP,
                  T.SCRAP_REASON,
                  T2.OUT_REFUR_TIME,
                  T2.COL_USER
        UNION
        SELECT REGEXP_REPLACE(T.JUDGE_STOVE_NO, '-.*', '') JUDGE_STOVE_NO,
               T.LOT_NO,
               T.PLINE_CODE,
               (SELECT B.PLINE_NAME
                  FROM COM_BASE_PLINE B
                 WHERE B.PLINE_CODE = T.PLINE_CODE) PLINE_NAME,
               DECODE(T2.COL_SHIFT,
                      1,
                      '早班',
                      2,
                      '中班',
                      3,
                      '夜班',
                      0,
                      '常白班') COL_SHIFT,
               DECODE(T2.COL_GROUP, 1, '甲', 2, '乙', 3, '丙', 4, '丁') COL_GROUP,
               T1.STEELNAME,
               T1.GRADENAME,
               T1.PIPE_SECTION,
               T.ACTUAL_LENGTH_OF_WASTE_PIPE,
               DECODE(T.PROCESS_ROUTE,
                      '0',
                      '旁通',
                      '1',
                      '快速入炉',
                      '2',
                      '在线常化') PROCESS_ROUTE,
               T.TRANSFER_RHYTHM,
               T.STEPPING_RHYTHM,
               TO_CHAR(T.IN_FUR_TIME, 'HH24:MI') IN_FUR_TIME,
               TO_CHAR(T.OUT_FUR_TIME, 'HH24:MI') OUT_FUR_TIME,
               T.FIRST_IN_TEMP,
               T.LAST_IN_TEMP,
               T.FIRST_OUT_TEMP,
               T.LAST_OUT_TEMP,
               T.SET_FUR_TEMP,
               T.SCRAP_REASON,
                (SELECT NVL(COUNT(*), 0)
                  FROM MIL_REFUR_RACK B
                 WHERE B.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
                   AND B.RESULT_NO = T.RESULT_NO
                   AND B.COL_SHIFT=T2.COL_SHIFT
                   AND B.COL_GROUP=T2.COL_GROUP
                   AND B.STATUS = '1') SCRAP_NUM,
               (SELECT NVL(COUNT(*), 0)
                  FROM MIL_REFUR_RACK B
                 WHERE B.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
                   AND B.RESULT_NO = T.RESULT_NO
                   AND B.COL_SHIFT=T2.COL_SHIFT
                   AND B.COL_GROUP=T2.COL_GROUP
                   AND B.STATUS = '0') OUT_FUR_NUM,
               TO_CHAR(T2.OUT_REFUR_TIME,'YYYY-MM-DD HH24:MI:SS') OUT_REFUR_TIME,
               T2.COL_USER
          FROM MIL_REFUR_RESULT T, MIL_PLAN T1, MIL_REFUR_RACK T2
         WHERE 1 = 1
           AND T.JUDGE_STOVE_NO = T1.JUDGE_STOVE_NO
           AND T2.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
           AND T2.RESULT_NO = T.RESULT_NO
           AND T2.JUDGE_STOVE_NO = T1.JUDGE_STOVE_NO
           AND T2.RESULT_NO = T1.ID
           --AND T2.MAT_NO IS NOT NULL
           AND T2.OUT_REFUR_TIME BETWEEN TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS') AND
               TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS')
           AND T2.COL_SHIFT LIKE '%' || ? || '%'
           AND T2.COL_GROUP LIKE '%' || ? || '%'
           AND T2.JUDGE_STOVE_NO LIKE '%' || ? || '%'
           #something#
         GROUP BY T.JUDGE_STOVE_NO,
                  T.RESULT_NO,
                  T.ACTUAL_LENGTH_OF_WASTE_PIPE,
                  T.LOT_NO,
                  T.PLINE_CODE,
                  T2.COL_SHIFT,
                  T2.COL_GROUP,
                  T1.STEELNAME,
                  T1.GRADENAME,
                  T1.PIPE_SECTION,
                  T.PROCESS_ROUTE,
                  T.TRANSFER_RHYTHM,
                  T.STEPPING_RHYTHM,
                  T.IN_FUR_TIME,
                  T.OUT_FUR_TIME,
                  T.FIRST_IN_TEMP,
                  T.LAST_IN_TEMP,
                  T.FIRST_OUT_TEMP,
                  T.LAST_OUT_TEMP,
                  T.SET_FUR_TEMP,
                  T.SCRAP_REASON,
                  T2.OUT_REFUR_TIME,
                  T2.COL_USER) AA
 GROUP BY AA.JUDGE_STOVE_NO,
          AA.PLINE_NAME,
          AA.ACTUAL_LENGTH_OF_WASTE_PIPE,
          AA.LOT_NO,
          AA.PLINE_CODE,
          AA.COL_SHIFT,
          AA.COL_GROUP,
          AA.STEELNAME,
          AA.GRADENAME,
          AA.PIPE_SECTION,
          AA.PROCESS_ROUTE,
          AA.TRANSFER_RHYTHM,
          AA.STEPPING_RHYTHM,
          AA.IN_FUR_TIME,
          AA.OUT_FUR_TIME,
          AA.FIRST_IN_TEMP,
          AA.LAST_IN_TEMP,
          AA.FIRST_OUT_TEMP,
          AA.LAST_OUT_TEMP,
          AA.SET_FUR_TEMP,
          AA.OUT_FUR_NUM,
          AA.SCRAP_REASON,
          AA.SCRAP_NUM,
          AA.OUT_REFUR_TIME,
          AA.COL_USER
 ORDER BY AA.OUT_REFUR_TIME
]]>
</query>
</queryMap>