<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc = "定径">
<query id = "FrmSizingReport.doQueryData" desc = "查询">
<![CDATA[
SELECT T2.LOT_NO,
       REGEXP_REPLACE(T.JUDGE_STOVE_NO, '-.*', '') JUDGE_STOVE_NO,
       (SELECT B.PLINE_NAME
          FROM COM_BASE_PLINE B
         WHERE B.PLINE_CODE = T.PLINE_CODE) PLINE_CODE,
       T1.GRADENAME,
       T.PIPE_SIZE,
       T.HOST_ELE_SPEED1,
       T.FOLD_ELE_SPEED1,
       T.ENTRANCE_SPEED,
       T.EXIT_SPEED,
       T.PASS_SERIES || '  ' || T.FINISH_ROLL_NUM AS PASS_ROLL_NUM,
       T.PRODUCT_SIZE,
       COUNT(T2.STATUS) PRODUCT_NUM,
       
       T2.SCRAP_REASON,
       (SELECT COUNT(*)
          FROM MIL_SIZING_RACK T2
         WHERE 1 = 1
           AND T2.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
           AND T2.SCRAP_LOC = '1') BEFORE_SIZING,
       (SELECT COUNT(*)
          FROM MIL_SIZING_RACK T3
         WHERE 1 = 1
           AND T3.SCRAP_LOC = '2'
           AND T3.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO) LATER_SIZING,
           TO_CHAR(T2.END_SIZING_TIME,'YYYY-MM-DD HH24:MI:SS')END_TIME,
          DECODE(T2.COL_SHIFT,'1','早班','2','中班','3','夜班', '0', '常白班')COL_SHIFT,
          DECODE(T2.COL_GROUP,'1','甲','2','乙','3','丙','4','丁')COL_GROUP,
          T2.COL_USER,
          T.REMARK,
          T.ENTRANCE_TEMP,
          T.EXIT_TEMP,
          T.EXIT_TEMP2,
          T.EXIT_TEMP3

  FROM MIL_SIZING_RACK T2
  LEFT JOIN MIL_SIZING_RESULT T ON T2.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
  LEFT JOIN MIL_PLAN T1 ON T2.JUDGE_STOVE_NO = T1.JUDGE_STOVE_NO
 WHERE T2.END_SIZING_TIME >= to_date(?,'yyyy-MM-dd HH24:mi:ss')
   AND T2.END_SIZING_TIME <= to_date(?,'yyyy-MM-dd HH24:mi:ss')
   AND T2.COL_SHIFT || '&' LIKE ('%' || ? || '%')
   AND T2.COL_GROUP || '&' LIKE ('%' || ? || '%')
   AND T2.JUDGE_STOVE_NO || '&' LIKE ('%' || ? || '%')

]]>
</query>
</queryMap>