<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc = "查询热轧钢管取样质量原始记录">
<query id = "FrmMilSamplingQuality.queryMinResult" desc = "查询">
<![CDATA[
select REGEXP_REPLACE(T.JUDGE_STOVE_NO, '-.*', '') JUDGE_STOVE_NO,
       T.PLINE_CODE,
       (SELECT B.PLINE_NAME
          FROM COM_BASE_PLINE B
         WHERE B.PLINE_CODE = T.PLINE_CODE) PLINE_NAME,
       DECODE(T.COL_SHIFT, 1, '早班', 2, '中班', 3, '夜班', 0, '常白班') COL_SHIFT,
       DECODE(T.COL_GROUP, 1, '甲班', 2, '乙班', 3, '丙班', 4, '丁班') COL_GROUP,
       T.CHECK_DATE,
       T1.PIPE_LOCATION,
       DECODE(T1.PIPE_LOCATION, '0', '管端', '1', '管体', '2', '管尾') PIPE_LOCATION1,
       CASE
        GREATEST(NVL(T1.D1, 0), NVL(T1.D2, 0), NVL(T1.D3, 0), NVL(T1.D4, 0))
         WHEN 0 THEN
          NULL
         ELSE
          GREATEST(NVL(T1.D1, 0),
                   NVL(T1.D2, 0),
                   NVL(T1.D3, 0),
                   NVL(T1.D4, 0))
       END DMAX,
       CASE LEAST(NVL(T1.D1, 99999),
              NVL(T1.D2, 99999),
              NVL(T1.D3, 99999),
              NVL(T1.D4, 99999))
         WHEN 99999 THEN
          NULL
         ELSE
          LEAST(NVL(T1.D1, 99999),
                NVL(T1.D2, 99999),
                NVL(T1.D3, 99999),
                NVL(T1.D4, 99999))
       END DMIN,
       T.REMARK,
       T.PASS_SERIES1,
       T.PASS_SERIES2,
       T.PASS_SERIES3,
       T.DOUBLE_B1,
       T.DOUBLE_B2,
       T.DOUBLE_B3,
       T.START_TEMP,
       T.END_TEMP,
       T2.VARIETIES ,
       T2.STEELNAME ,
       T2.GRADENAME ,
       T2.PIPE_SIZE ,
       T2.CUT_HEAD_LENGTHA ,
       T2.CUT_TRAIL_LENGTHA ,
       T3.BEGIN_ROLLING_TEMP ,
       T3.EXIT_TEMP ,
       T1.D1,
       T1.D2,
       T1.D3,
       T1.D4,
       T1.S1,
       T1.S2,
       T1.S3,
       T1.S4,
       T1.S5,
       T1.S6,
       T1.S7,
       T1.S8,
       T1.SMAX,
       T1.SMIN,
       T1.PASS_SERIES,
       T1.DOUBLE_B
  from MIL_HOT_CHECK        t,
       MIL_HOT_CHECK_DETAIL T1,
       MIL_PLAN             T2,
       MIL_SIZING_RESULT    T3
 WHERE T.JUDGE_STOVE_NO = T1.JUDGE_STOVE_NO(+)
   AND T.JUDGE_STOVE_NO = T2.JUDGE_STOVE_NO(+)
   AND T.JUDGE_STOVE_NO = T3.JUDGE_STOVE_NO(+)
]]>
</query>
</queryMap>